我有一个正在生产的应用程序,该应用程序创建了约150个线程,这些线程在约45秒内完成。最近,我们开始遇到内存问题。事实证明,由于锁定NativePRNG,线程永远不会完成并随着时间累加。
我们的测试/备份机器只有这个问题。生产机器运行同一罐子没有问题。
这是线程的堆栈跟踪
"VSGADNE01" #923 prio=5 os_prio=0 tid=0x00007f7698e41800 nid=0x2b32 runnable
[0x00007f7601ac3000]
java.lang.Thread.State: RUNNABLE
at java.util.Arrays.copyOfRange(Arrays.java:3520)
at sun.security.provider.NativePRNG$RandomIO.implNextBytes(NativePRNG.java:553)
- locked <0x00000005cdf9c660> (a java.lang.Object)
at sun.security.provider.NativePRNG$RandomIO.access$400(NativePRNG.java:331)
at sun.security.provider.NativePRNG.engineNextBytes(NativePRNG.java:220)
at java.security.SecureRandom.nextBytes(SecureRandom.java:468)
at com.jcraft.jsch.jce.Random.fill(Random.java:78)
at com.jcraft.jsch.Packet.padding(Packet.java:59)
- locked <0x00000005cde992d0> (a com.jcraft.jsch.jce.Random)
at com.jcraft.jsch.Session.encode(Session.java:885)
at com.jcraft.jsch.Session._write(Session.java:1366)
- locked <0x000000064974f720> (a java.lang.Object)
at com.jcraft.jsch.Session.write(Session.java:1335)
at com.jcraft.jsch.ChannelSftp.sendPacketPath(ChannelSftp.java:2575)
at com.jcraft.jsch.ChannelSftp.sendPacketPath(ChannelSftp.java:2559)
at com.jcraft.jsch.ChannelSftp.sendCLOSE(ChannelSftp.java:2538)
at com.jcraft.jsch.ChannelSftp._sendCLOSE(ChannelSftp.java:2464)
at com.jcraft.jsch.ChannelSftp._get(ChannelSftp.java:1155)
at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:961)
at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:873)
at com.ngss.vodafone.oss.ebm.Controller.SftpUtils.getFiles(SftpUtils.java:141)
at com.ngss.vodafone.oss.ebm.Controller.SftpUtils.download(SftpUtils.java:187)
at com.ngss.vodafone.oss.ebm.Controller.Host.downloadFiles(Host.java:108)
at com.ngss.vodafone.oss.ebm.Controller.Host.run(Host.java:86)
at java.lang.Thread.run(Thread.java:748)
我尝试失败的事情:
java -version
包括以下两台计算机:
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
两台机器都是Red Hat Enterprise Linux Server 7.4(Maipo)