qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lorenz Quack (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (QPID-7399) [Java Broker] ClosedSelectorException during shutdown
Date Fri, 27 Oct 2017 13:31:00 GMT

    [ https://issues.apache.org/jira/browse/QPID-7399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16222358#comment-16222358
] 

Lorenz Quack commented on QPID-7399:
------------------------------------

My analysis (current revision is 626666a) is as follows:
# The selector thread detects acceptable keys and puts the Runnable on line 196 onto the {{_workQueue}}.
# In the meantime something closes the AmqpPort which calls {{AmqpPortImpl#onClose}} ->
{{TCPandSSLTransport#close}} -> {{NetworkConnectionScheduler#close}} -> {{SelectorThread#close}}
which sets {{_closed}} to {{true}}.
# The selector thread now reaches the end of the while loop in {{SelectionTask#performSelect}}
and calls {{SelectionTask#closeSelector}} which closes the {{_selector}}.
# Now a different IO-Thread picks up the Runnable from step 1. from the {{_workQueue}} and
starts executing it. Notice that the Runnable is a closure around the former selector thread's
{{SelectorTask}} (the one who's {{_selector}} was closed in step 3.).
# When trying to use the {{_selector}} in line 210 we get the above {{ClosedSelectorException}}

For now I will simply catch the exception which seems to occur rarely.
Since {{Selector#close}} is synchronized on the selector itself (see Concurrency section of
[the docs|https://docs.oracle.com/javase/8/docs/api/java/nio/channels/Selector.html]) we could
alternatively synchronize a block around the call to {{channel.register}} in line 210.


> [Java Broker] ClosedSelectorException during shutdown
> -----------------------------------------------------
>
>                 Key: QPID-7399
>                 URL: https://issues.apache.org/jira/browse/QPID-7399
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>            Reporter: Lorenz Quack
>            Priority: Minor
>             Fix For: qpid-java-broker-7.0.0
>
>         Attachments: TEST-org.apache.qpid.transport.MaxFrameSizeTest.testTooLargeFrameSize.txt
>
>
> Today the Jenkins mms.0-9-1 job on trunk failed the test {{MaxFrameSizeTest.testTooSmallFrameSize}}
but the actual problem seems to have been during shutdown of {{MaxFrameSizeTest.testTooLargeFrameSize}}.
There the following exception occurred:
> {code}
> 2016-08-23 20:26:34,118         ERROR [IO-pool-Port-amqp-2] o.a.q.t.u.InternalBrokerHolder
Uncaught exception from thread IO-pool-Port-amqp-2
> java.nio.channels.ClosedSelectorException: null
> 	at sun.nio.ch.EPollSelectorImpl.putEventOps(EPollSelectorImpl.java:185) ~[na:1.7.0_80]
> 	at sun.nio.ch.ServerSocketChannelImpl.translateAndSetInterestOps(ServerSocketChannelImpl.java:361)
~[na:1.7.0_80]
> 	at sun.nio.ch.SelectionKeyImpl.nioInterestOps(SelectionKeyImpl.java:105) ~[na:1.7.0_80]
> 	at sun.nio.ch.SelectionKeyImpl.interestOps(SelectionKeyImpl.java:83) ~[na:1.7.0_80]
> 	at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:201)
~[na:1.7.0_80]
> 	at org.apache.qpid.server.transport.SelectorThread$SelectionTask$1.run(SelectorThread.java:197)
~[qpid-broker-core-6.1.0-SNAPSHOT.jar:6.1.0-SNAPSHOT]
> 	at org.apache.qpid.server.transport.SelectorThread.run(SelectorThread.java:462) ~[qpid-broker-core-6.1.0-SNAPSHOT.jar:6.1.0-SNAPSHOT]
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) ~[na:1.7.0_80]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ~[na:1.7.0_80]
> 	at java.lang.Thread.run(Thread.java:745) ~[na:1.7.0_80]
> {code}
> The full log is attached.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message