[QFJ-897] AbstractSocketAcceptor does not stop its internal IoAcceptors correctly Created: 11/Jul/16  Updated: 13/Dec/16  Resolved: 11/Jul/16

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.6.2
Fix Version/s: 1.6.3

Type: Bug Priority: Default
Reporter: Uwe Guenther Assignee: Uwe Guenther
Resolution: Fixed Votes: 0
Labels: QuickfixJ
Environment:

Linux


Attachments: Java Source File MyThreadedSocketAcceptor.java    

 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();
        }
    }


 Comments   
Comment by Uwe Guenther [ 11/Jul/16 ]

if you MyThreadedSocketAcceptor.java instead of ThreadedSocketAcceptor.java you can work around this issue.

Comment by Christoph John [ 11/Jul/16 ]

Hi Uwe, thanks for the report and suggested fix.
Cheers,
Chris.

Comment by Uwe Guenther [ 11/Jul/16 ]

Hi Chris, you are welcome! Is there a release plan for 1.6.3? Cheers Uwe

Generated at Fri May 03 07:41:02 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.