Uploaded image for project: 'QuickFIX/J'
  1. QuickFIX/J
  2. QFJ-897

AbstractSocketAcceptor does not stop its internal IoAcceptors correctly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Default
    • Resolution: Fixed
    • Affects Version/s: 1.6.2
    • Fix Version/s: 1.6.3
    • Component/s: Engine
    • Labels:
    • Environment:
      Linux

      Description

      We having a productive setup where we are reuse sessions and create, start, stop ThreadedSocketAcceptor as we need them. We do not reuse them.

      In Prod we saw the following problem: We were running out of file descriptors on ore 32 CPU Linux box with a max open file desriptor settings of 4096 after several days running around 20 quickfixj sessions within one JVM.

      Issue:
      After debugging the quickfixj and the apache mina code we found out, quickfixj is only unbinding the internal used IoAcceptors in its protected method AbstractSocketAcceptor#stopAcceptingConnections(), but not disposing them which is releasing the NIO Selectors used by Apache Mina. As a result the ExecutorServices created by Mina are not shouting down and their run() method is waiting on an internal inter thread communication lock forever.

      Solution:
      Just do a ioAcceptor.dispose(true); in ioAcceptor.unbind(); in quickfix.mina.acceptor.AbstractSocketAcceptor#stopAcceptingConnections() after line 248

          protected void stopAcceptingConnections() throws ConfigError {
              Iterator<IoAcceptor> ioIt = ioAcceptors.values().iterator();
              while (ioIt.hasNext()) {
                  IoAcceptor ioAcceptor = ioIt.next();
                  SocketAddress localAddress = ioAcceptor.getLocalAddress();
                  ioAcceptor.unbind();
                  ioAcceptor.dispose(true);
                  log.info("No longer accepting connections on " + localAddress);
                  ioIt.remove();
              }
          }
      

        Attachments

          Activity

            People

            • Assignee:
              uwe_guenther Uwe Guenther
              Reporter:
              uwe_guenther Uwe Guenther
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: