java.net.SocketException: Invalid argument: no further information

QuickFIX/J JIRA | Christoph John | 8 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Youyu Shao provided some fixes on the mailing list. Original mail: On 23/06/16 02:35, Youyu Shao wrote: > QuickFIX/J Documentation: http://www.quickfixj.org/documentation/ > QuickFIX/J Support: http://www.quickfixj.org/support/ > > > Recently we have been seriously looking into using QuickFixJ (code base > 1.6.2). > In so doing, we have discovered several problems and subsequently resolved > in house. > > 1. Mina would throw org.apache.mina.core.RuntimeIoException wrapping > java.net.SocketException at various places. > For example, this happens at: > org.apache.mina.core.RuntimeIoException: java.net.SocketException: > Invalid argument: no further information > at > org.apache.mina.transport.socket.nio.NioSocketSession$SessionConfigImpl.setTcpNoDelay(NioSocketSession.java:208) > at quickfix.mina.NetworkingOptions.apply(NetworkingOptions.java:155) > at > quickfix.mina.AbstractIoHandler.sessionCreated(AbstractIoHandler.java:93) > at > quickfix.mina.initiator.InitiatorIoHandler.sessionCreated(InitiatorIoHandler.java:50) > ..... > When this happens, exceptionCaught method of AbstractIoHandler is not > able to properly detect there was an underlying socket IOException. > AbstractIoHandler has been modified to un-wrap the exception and see if > along the exception chain there is an IOException. > > 2. org.apache.mina.core.session.IoSession internal state is problematic. On > and off, > IoSession.isConnected() does not return the correct value after QuickFixJ > called IoSession.close() method(up on experiencing IOException). > quickfix.mina.initiator.IoSessionInitiator has been refactored to replace > the old IoConnector with a new one upon experiencing IOException. > quickfix.mina.AbstractIoHandler is adjusted accordingly to signal the > IoSessionInitiator to do so. > > 3. Modified the run() method of ConnectTask in IoSessionInitiator to be > protected by try block. This is to prevent the scheduled Task from > stop running in presence of exception. (see javadoc on > scheduleWithFixedDelay(...) method of > java.util.concurrent.ScheduledExecutorService > which states that "...If any execution of the task encounters an > exception, subsequent executions are suppressed...") > > 4. Again, org.apache.mina.core.session.IoSession internal state is > problematic. Even after the > normal disconnect() from IoSessionResponder, on and off the > IoSession.isConnected() still does not return the correct value. > quickfix.mina.IoSessionResponder is adjusted to signal the > IoSessionInitiator to replace the IoConnector. IoSessionResponderTest is > adjusted accordingly. > > > 5. quickfix.ThreadedSocketAcceptor leaks resources when stoped. > Instead of calling stopSessionTimer() in the stop() method, it should > call stopInitiators(). > > Problems identified in 1, 2, 3, and 4 ultimately manifested them in ways > that reconnecting would stop working (forever), even absent of IOExceptions. > > With the fix, we have the QuickFixJ engine running for a week where > reconnecting works with no problem. During this period the counterparty > logged out and severed the TCP connection more than 20000 times. Our test > also indicates that the fix works equally SSL vs non-SSL. > > Modified files are attached. > > AbstractIoHandler.java > <http://quickfix-j.364392.n2.nabble.com/file/n7579557/AbstractIoHandler.java> > IoSessionInitiator.java > <http://quickfix-j.364392.n2.nabble.com/file/n7579557/IoSessionInitiator.java> > IoSessionResponder.java > <http://quickfix-j.364392.n2.nabble.com/file/n7579557/IoSessionResponder.java> > IoSessionResponderTest.java > <http://quickfix-j.364392.n2.nabble.com/file/n7579557/IoSessionResponderTest.java> > ThreadedSocketInitiator.java > <http://quickfix-j.364392.n2.nabble.com/file/n7579557/ThreadedSocketInitiator.java> >

    QuickFIX/J JIRA | 8 months ago | Christoph John
    java.net.SocketException: Invalid argument: no further information

    Root Cause Analysis

    1. java.net.SocketException

      Invalid argument: no further information

      at org.apache.mina.transport.socket.nio.NioSocketSession$SessionConfigImpl.setTcpNoDelay()
    2. Apache MINA Core
      NioSocketSession$SessionConfigImpl.setTcpNoDelay
      1. org.apache.mina.transport.socket.nio.NioSocketSession$SessionConfigImpl.setTcpNoDelay(NioSocketSession.java:208)
      1 frame
    3. Apache ServiceMix :: Bundles :: ${pkgArtifactId}
      InitiatorIoHandler.sessionCreated
      1. quickfix.mina.NetworkingOptions.apply(NetworkingOptions.java:155)
      2. quickfix.mina.AbstractIoHandler.sessionCreated(AbstractIoHandler.java:93)
      3. quickfix.mina.initiator.InitiatorIoHandler.sessionCreated(InitiatorIoHandler.java:50)
      3 frames