Refinitiv / Real-Time-SDK

Other
191 stars 129 forks source link

CryptoHelper.java not able to detect socket close due to which application hang infinitely #272

Closed beingtech closed 6 months ago

beingtech commented 8 months ago

Many times when client disconnect and application is trying to send data application hang infinitely

Cause :- CryptoHelper.java

Line 417 :- SSLEngineResult result = _engine.wrap(src, _netSendBuffer); This is returning => result.getStatus() == Status.BUFFER_OVERFLOW

Line 435 :- if (_socketChannel.write(_netSendBuffer) <= 0) This is throwing following

java.io.IOException: An established connection was aborted by the software in your host machine at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method) at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:54) at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:132) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:76) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:53) at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:532) at com.refinitiv.eta.transport.CryptoHelper.write(CryptoHelper.java:435) at com.refinitiv.eta.transport.CryptoHelper.write(CryptoHelper.java:464) at com.refinitiv.eta.transport.EncryptedSocketHelper.write(EncryptedSocketHelper.java:25) at com.refinitiv.eta.transport.RsslSocketChannel.write(RsslSocketChannel.java:671) at com.refinitiv.eta.transport.RsslSocketChannel.writeGatheringByteArray(RsslSocketChannel.java:2737) at com.refinitiv.eta.transport.RsslSocketChannel.flushInternal(RsslSocketChannel.java:2660) at com.refinitiv.eta.transport.RsslSocketChannel.writeWithBuffersQueued(RsslSocketChannel.java:2506) at com.refinitiv.eta.transport.RsslSocketChannel.write(RsslSocketChannel.java:2268) at com.refinitiv.eta.valueadd.reactor.Reactor.submitChannel(Reactor.java:4388) at com.refinitiv.eta.valueadd.reactor.Reactor.submitChannel(Reactor.java:4498) at com.refinitiv.eta.valueadd.reactor.ReactorChannel.submit(ReactorChannel.java:829) at com.refinitiv.ema.access.OmmIProviderImpl.submit(OmmIProviderImpl.java:1087) at com.refinitiv.ema.access.OmmIProviderImpl.submit(OmmIProviderImpl.java:690)

Line 442 :- catch (IOException e) above exception is catched by line 442 and control again goes to line 417 and again same flow repeat

Above flow is getting repeated infinitely which lead to application get hanged as thread as already acquired writelock and it will never get released.

L-Karchevska commented 8 months ago

@beingtech Thank you for bringing this issue to our attention and for the details provided! We created an internal Jira to investigate it. In the meantime, could you provide the version of the API you are using?

beingtech commented 8 months ago

@L-Karchevska Thanks for your quick prompt.

We are using latest group: 'com.refinitiv.ema', name: 'ema', version: '3.7.3.0'

This issue seems blocker for us so quick fix will be highly appreciated.

L-Karchevska commented 8 months ago

@beingtech Thank you for the information!

beingtech commented 7 months ago

@L-Karchevska Is there any update on this ?

soranat commented 7 months ago

@beingtech This issue will be fixed in the next release RTSDK 2.2.0.L1

vlevendel commented 6 months ago

RTSDK 2.2.0.L1 addresses this issue. Please let us know if you have further concerns. Closing.