[ https://issues.apache.org/jira/browse/SSHD-1256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17609006#comment-17609006 ]
Thomas Wolf commented on SSHD-1256: ----------------------------------- No need to be sorry at all. Tracking this down needs more than my two eyes. We don't stop and restart a socket acceptor, though. OK, MINA may under the hood stop its {{AbstractPollingIoAcceptor.Acceptor}} thread and create a new one. Haven't gotten that far in analyzing yet, but I think it may happen even if the same {{AbstractPollingIoAcceptor.Acceptor}} instance is used. The main loop there is (much simplified) {code:java} while (selectable) { registerHandles(); // Process registration queue: add new sockets (from bind()) to the selector with OP_ACCEPT, fulfills their open futures int selected = select(); if (/* nothing to do */) { break; // and end the thread; higher layers will create a new one if needed } if (selected > 0) { processHandles(selectedHandles()); // Handle and hand off new connections } unregisterHandles(); // Process cancel queue: cancel SelectionKey, close ServerSocketChannel, fulfill the cancel future } {code} So it cancels the {{{}SelectionKey{}}}s at the end of the loop, but that cancellation may take effect only on the next iteration in {{select()}} on Java >= 11. If there is already a new registration request for the same socket, {{registerHandles()}} will get that "port already in use" exception. At least that's my current theory. [~chrjohn]: can you confirm that your test only has problems if run on Java >= 11? And can you point to your failing test? > PortForwardingTest.testRemoteForwardingSecondTimeInSameSession sometimes > fails in Github CI > ------------------------------------------------------------------------------------------- > > Key: SSHD-1256 > URL: https://issues.apache.org/jira/browse/SSHD-1256 > Project: MINA SSHD > Issue Type: Bug > Affects Versions: 2.9.0 > Reporter: Thomas Wolf > Priority: Major > > Cannot reproduce locally. A timing issue? -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org