NIO SelectorWorker not protecting its Selector from mutable operations
----------------------------------------------------------------------

                 Key: AMQ-2277
                 URL: https://issues.apache.org/activemq/browse/AMQ-2277
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 5.2.0
         Environment: 5.2.x, trunk. Problem seen on Linux and Solaris.
            Reporter: Dave Stanley
         Attachments: nio_patch.txt

When you hit the NIO transport with heavy concurrent connection load the 
brokers thread usage spikes with lots of threads in the state below.   

"ActiveMQ Transport Initiator: /10.129.112.166:59560" daemon prio=10 
tid=0x007a2fc0 nid=0x34b waiting for monitor entry [0xc4381000..0xc4381888]
        at 
org.apache.activemq.transport.nio.SelectorManager.register(SelectorManager.java:65)
        - waiting to lock <0xd8b1d920> (a 
org.apache.activemq.transport.nio.SelectorManager)
        at 
org.apache.activemq.transport.nio.NIOTransport.initializeStreams(NIOTransport.java:66)
        at 
org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:453)
        at 
org.apache.activemq.transport.nio.NIOTransport.doStart(NIOTransport.java:146)
        at 
org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:53)        at 
org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:57)
        at 
org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:57)
        at 
org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:72)
        at 
org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:57)
        at 
org.apache.activemq.broker.TransportConnection.start(TransportConnection.java:880)
        - locked <0xdb727578> (a 
org.apache.activemq.broker.jmx.ManagedTransportConnection)
        at 
org.apache.activemq.broker.TransportConnector$1$1.run(TransportConnector.java:213)

Problem is easily reproducible when consumer/producer are on a different 
machine to the broker - when running everything locally .. not so much.

It seems the SelectorWorker is not tolerant of lots of concurrent updates to 
the state of the Selector, and the selector gets into a bad state. 

Attached patch seems to resolve the issue. Patch adds some locking around when 
selectorKeys are registered and canceled.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to