[
https://issues.apache.org/jira/browse/QPID-7368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15591858#comment-15591858
]
Alex Rudyy commented on QPID-7368:
----------------------------------
I looked through our IO layer implementation and came to conclusion that
canceling of SelectionKey for client SocketChannel from NonBlockingConnection
as part of NonBlockingConnection#shudown() invoked from
NonBlockingConnection#doWork() cannot cause the reported issue (as Lorenz
suggested): NonBlockingConnection#doWork() is invoked after registering of 0
interest on a selector; as result, no SlectionKey can be returned from
Selector#selectedKeys() for closing NonBlockingConnection. It seems that
Selector#selectedKeys() returned SelectionKey for the ServerSocketChannel which
was canceled as part of invocation of ServerSocket#close() in result of
NonBlockingNetworkTransport#close() on AmqpPort close. I think that Keith's
suggestion to deregister OP_ACCEPT interest from the accepting socket channel
before closing the socket should fix the issue.
> CancelledKeyException from accepting socket during Broker shutdown
> ------------------------------------------------------------------
>
> Key: QPID-7368
> URL: https://issues.apache.org/jira/browse/QPID-7368
> Project: Qpid
> Issue Type: Bug
> Components: Java Broker
> Reporter: Keith Wall
> Fix For: qpid-java-6.1
>
> Attachments: 0001-QPID-7368-Handle-cancelled-selected-key.patch,
> TEST-org.apache.qpid.transport.ProtocolNegotiationTest.testWrongProtocolHeaderSent_BrokerRespondsWithSupportedProtocol.txt
>
>
> We saw the following test failure on trunk whilst the test was shutting down
> a Broker.
> https://builds.apache.org/view/M-R/view/Qpid/job/Qpid-Java-Java-Test-JDK1.8/lastCompletedBuild/testReport/org.apache.qpid.transport/ProtocolNegotiationTest/testWrongProtocolHeaderSent_BrokerRespondsWithSupportedProtocol/
> Thread terminated due to uncaught exception
> {noformat}
> java.nio.channels.CancelledKeyException
> at sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:73)
> at sun.nio.ch.SelectionKeyImpl.readyOps(SelectionKeyImpl.java:87)
> at java.nio.channels.SelectionKey.isAcceptable(SelectionKey.java:360)
> at
> org.apache.qpid.server.transport.SelectorThread$SelectionTask.processSelectionKeys(SelectorThread.java:167)
> at
> org.apache.qpid.server.transport.SelectorThread$SelectionTask.performSelect(SelectorThread.java:305)
> at
> org.apache.qpid.server.transport.SelectorThread$SelectionTask.run(SelectorThread.java:87)
> at
> org.apache.qpid.server.transport.SelectorThread.run(SelectorThread.java:462)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]