我们有一个使用DTLS与服务器通信的应用程序(我们没有源)。通讯正常工作了一个小时左右,但此后在握手期间通讯线程挂起。我们将源代码一直跟踪到java.net.PlainDatagramSocketImpl.receive0
。
在这里,我们看到了从BC发送的1000ms超时,但是似乎我们的代码仍然没有SocketTimeoutException
。
Bouncycastle是否可以在出局时吃掉异常,然后无限地重试?还是可能发生其他情况?
堆栈跟踪:
"pool-64-thread-14@4646" prio=5 tid=0x10e nid=NA runnable
java.lang.Thread.State: RUNNABLE
at java.net.PlainDatagramSocketImpl.receive0(PlainDatagramSocketImpl.java:-1)
- locked <merged>(a java.net.PlainDatagramSocketImpl)
at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:144)
at java.net.DatagramSocket.receive(DatagramSocket.java:812)
- locked <merged>(a java.net.DatagramSocket)
- locked <merged>(a java.net.DatagramPacket)
at org.bouncycastle.tls.UDPTransport.receive(Unknown Source:-1)
at org.bouncycastle.tls.DTLSRecordLayer.receiveRecord(Unknown Source:-1)
at org.bouncycastle.tls.DTLSRecordLayer.receive(Unknown Source:-1)
at org.bouncycastle.tls.DTLSReliableHandshake.receiveMessage(Unknown Source:-1)
at org.bouncycastle.tls.DTLSReliableHandshake.receiveMessageBody(Unknown Source:-1)
at org.bouncycastle.tls.DTLSClientProtocol.clientHandshake(Unknown Source:-1)
at org.bouncycastle.tls.DTLSClientProtocol.connect(Unknown Source:-1)
at com.x.y.z.gateway.SessionTracker.openDTLSConnection(SessionTracker.java:83)
at com.x.y.z.gateway.SessionTracker.createTlsSession(SessionTracker.java:67)
at com.x.y.z.gateway.SessionTracker.createGatewaySession(SessionTracker.java:49)
at com.x.y.z.gateway.SessionTracker$$Lambda$233.13423545.get(Unknown Source:-1)
at com.x.y.z.gateway.SessionPool.getSession(SessionPool.java:53)
at com.x.y.z.gateway.SessionTracker.getGatewaySession(SessionTracker.java:41)
at com.x.y.z.gateway.ZIPGatewayWrapper.getGatewaySession(ZIPGatewayWrapper.java:44)
at com.x.y.z.gateway.NodeConnection.prepareDtlsSession(NodeConnection.java:150)
at com.x.y.z.gateway.NodeConnection.send(NodeConnection.java:104)
- locked <merged>(a com.x.y.z.gateway.NodeConnection)
at com.x.y.z.gateway.NodeConnection.run(NodeConnection.java:76)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)