Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.7
    • Fix Version/s: 2.0.10
    • Component/s: Filter
    • Labels:
      None
    • Environment:
      JRE 1.6, Linux

      Description

      I write a SSL client to connect server through SOCKS5 proxy, then meet a deadlock.
      Maybe the reason of deadlock is I write data to a IoSession in my main thread, but now this session is reading data from socket.

      Found one Java-level deadlock:
      =============================
      "NioProcessor-7":
      waiting to lock monitor 0x0940a8a8 (object 0x98732818, a org.apache.mina.filter.ssl.SslHandler),
      which is held by "Thread-102"
      "Thread-102":
      waiting to lock monitor 0x09e8128c (object 0x9873d750, a org.apache.mina.proxy.handlers.socks.Socks5LogicHandler),
      which is held by "NioProcessor-7"

      Java stack information for the threads listed above:
      ===================================================
      "NioProcessor-7":
      at org.apache.mina.filter.ssl.SslFilter.filterWrite(SslFilter.java:576)

      • waiting to lock <0x98732818> (a org.apache.mina.filter.ssl.SslHandler)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:482)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1400(DefaultIoFilterChain.java:47)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:775)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterWrite(DefaultIoFilterChain.java:705)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:482)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterWrite(DefaultIoFilterChain.java:475)
        at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:494)
        at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:439)
        at xxx.xxxProxyHandler.messageReceived(xxxProxyHandler.java:74)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:690)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765)
        at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:322)
        at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:497)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765)
        at org.apache.mina.proxy.filter.ProxyFilter.messageReceived(ProxyFilter.java:153)
      • locked <0x9873d750> (a org.apache.mina.proxy.handlers.socks.Socks5LogicHandler)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765)
        at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:410)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:710)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:664)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:653)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1124)
        at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
        "Thread-102":
        at org.apache.mina.proxy.filter.ProxyFilter.writeData(ProxyFilter.java:209)
      • waiting to lock <0x9873d750> (a org.apache.mina.proxy.handlers.socks.Socks5LogicHandler)
        at org.apache.mina.proxy.filter.ProxyFilter.filterWrite(ProxyFilter.java:192)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:482)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1400(DefaultIoFilterChain.java:47)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:775)
        at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:316)
      • locked <0x98732818> (a org.apache.mina.filter.ssl.SslHandler)
        at org.apache.mina.filter.ssl.SslFilter.filterWrite(SslFilter.java:609)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:482)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1400(DefaultIoFilterChain.java:47)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:775)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterWrite(DefaultIoFilterChain.java:705)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:482)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterWrite(DefaultIoFilterChain.java:475)
        at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:494)
        at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:439)
        at xxx.run(xxx.java:219)
        at java.lang.Thread.run(Unknown Source)

        Issue Links

          Activity

          Hide
          elecharny Emmanuel Lecharny added a comment -

          Have you tried with 2.0.9 ?

          Show
          elecharny Emmanuel Lecharny added a comment - Have you tried with 2.0.9 ?
          Hide
          yzb81 yzb81 added a comment -

          Yes, I have tried with 2.0.9, but the condition seems more serious, the deadlock comes without proxy.

          2014-11-10 11:32:59
          Full thread dump Java HotSpot(TM) Client VM (20.4-b02 mixed mode):

          "NioProcessor-8" prio=10 tid=0x8c01e400 nid=0x466b waiting on condition [0x8afee000]
          java.lang.Thread.State: WAITING (parking)
          at sun.misc.Unsafe.park(Native Method)

          • parking to wait for <0x99002710> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
            at java.util.concurrent.locks.LockSupport.park(Unknown Source)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown Source)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source)
            at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown Source)
            at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source)
            at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:313)
            at org.apache.mina.filter.ssl.SslFilter.filterClose(SslFilter.java:672)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:644)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1600(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:958)
            at org.apache.mina.core.filterchain.IoFilterAdapter.filterClose(IoFilterAdapter.java:130)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:644)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1600(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:958)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterClose(DefaultIoFilterChain.java:882)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:644)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterClose(DefaultIoFilterChain.java:637)
            at org.apache.mina.core.session.AbstractIoSession.close(AbstractIoSession.java:318)
            at org.apache.mina.core.session.AbstractIoSession.close(AbstractIoSession.java:297)
            at xxx.messageReceived(xxx.java:360)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:208)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:323)
            at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:520)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:714)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1121)
            at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)

          "NioProcessor-4" prio=10 tid=0x8c02ec00 nid=0x4655 in Object.wait() [0x8e8e0000]
          java.lang.Thread.State: WAITING (on object monitor)
          at java.lang.Object.wait(Native Method)
          at java.lang.Object.wait(Object.java:485)
          at edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:199)

          • locked <0x98828a98> (a edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock$NonfairSync)
            at edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:481)
            at xxx.messageReceived(xxx.java:360)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:208)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:323)
            at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:520)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:714)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1121)
            at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)

          "NioProcessor-2" prio=10 tid=0x8c031400 nid=0x4638 waiting on condition [0x8b858000]
          java.lang.Thread.State: WAITING (parking)
          at sun.misc.Unsafe.park(Native Method)

          • parking to wait for <0x989458d0> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
            at java.util.concurrent.locks.LockSupport.park(Unknown Source)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown Source)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source)
            at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown Source)
            at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source)
            at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:313)
            at org.apache.mina.filter.ssl.SslFilter.filterClose(SslFilter.java:672)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:644)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1600(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:958)
            at org.apache.mina.core.filterchain.IoFilterAdapter.filterClose(IoFilterAdapter.java:130)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:644)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1600(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:958)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterClose(DefaultIoFilterChain.java:882)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:644)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterClose(DefaultIoFilterChain.java:637)
            at org.apache.mina.core.session.AbstractIoSession.close(AbstractIoSession.java:318)
            at org.apache.mina.core.session.AbstractIoSession.close(AbstractIoSession.java:297)
            at xxx.messageReceived(xxx.java:360)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:208)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:323)
            at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:520)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:714)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1121)
            at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)

          "NioProcessor-6" prio=10 tid=0x8c056400 nid=0x4568 in Object.wait() [0x8b6fe000]
          java.lang.Thread.State: WAITING (on object monitor)
          at java.lang.Object.wait(Native Method)

          • waiting on <0x98828a98> (a edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock$NonfairSync)
            at java.lang.Object.wait(Object.java:485)
            at edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:199)
          • locked <0x98828a98> (a edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock$NonfairSync)
            at edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:481)
            at xxx.messageReceived(xxx.java:360)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:208)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:323)
            at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:520)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:714)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1121)
            at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)

          "NioProcessor-3" prio=10 tid=0x09033400 nid=0x4565 waiting on condition [0x8eb68000]
          java.lang.Thread.State: WAITING (parking)
          at sun.misc.Unsafe.park(Native Method)

          • parking to wait for <0x989458d0> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
            at java.util.concurrent.locks.LockSupport.park(Unknown Source)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown Source)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source)
            at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown Source)
            at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source)
            at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:313)
            at org.apache.mina.filter.ssl.SslFilter.filterWrite(SslFilter.java:639)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:625)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1500(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:953)
            at org.apache.mina.core.filterchain.IoFilterAdapter.filterWrite(IoFilterAdapter.java:123)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:625)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1500(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:953)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterWrite(DefaultIoFilterChain.java:877)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:625)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterWrite(DefaultIoFilterChain.java:618)
            at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:502)
            at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:447)
            at xxx.messageReceived(xxx.java:74)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:323)
            at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:520)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.proxy.filter.ProxyFilter.messageReceived(ProxyFilter.java:153)
          • locked <0x98935280> (a org.apache.mina.proxy.handlers.socks.Socks5LogicHandler)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
            at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:714)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
            at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1121)
            at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)

          "Thread-102" prio=10 tid=0x8c20e000 nid=0x4560 waiting on condition [0x8c1ad000]
          java.lang.Thread.State: WAITING (parking)
          at sun.misc.Unsafe.park(Native Method)

          • parking to wait for <0x988a3ce0> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
            at java.util.concurrent.locks.LockSupport.park(Unknown Source)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown Source)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source)
            at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown Source)
            at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source)
            at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:313)
            at org.apache.mina.filter.ssl.SslFilter.filterWrite(SslFilter.java:639)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:625)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1500(DefaultIoFilterChain.java:48)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:953)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterWrite(DefaultIoFilterChain.java:877)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:625)
            at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterWrite(DefaultIoFilterChain.java:618)
            at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:502)
            at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:447)
            at xxx.run(xxx.java:219)
            at java.lang.Thread.run(Unknown Source)
          Show
          yzb81 yzb81 added a comment - Yes, I have tried with 2.0.9, but the condition seems more serious, the deadlock comes without proxy. 2014-11-10 11:32:59 Full thread dump Java HotSpot(TM) Client VM (20.4-b02 mixed mode): "NioProcessor-8" prio=10 tid=0x8c01e400 nid=0x466b waiting on condition [0x8afee000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) parking to wait for <0x99002710> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source) at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown Source) at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source) at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:313) at org.apache.mina.filter.ssl.SslFilter.filterClose(SslFilter.java:672) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:644) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1600(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:958) at org.apache.mina.core.filterchain.IoFilterAdapter.filterClose(IoFilterAdapter.java:130) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:644) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1600(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:958) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterClose(DefaultIoFilterChain.java:882) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:644) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterClose(DefaultIoFilterChain.java:637) at org.apache.mina.core.session.AbstractIoSession.close(AbstractIoSession.java:318) at org.apache.mina.core.session.AbstractIoSession.close(AbstractIoSession.java:297) at xxx.messageReceived(xxx.java:360) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:208) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:323) at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:520) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535) at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:714) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657) at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67) at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1121) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "NioProcessor-4" prio=10 tid=0x8c02ec00 nid=0x4655 in Object.wait() [0x8e8e0000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:485) at edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:199) locked <0x98828a98> (a edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock$NonfairSync) at edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:481) at xxx.messageReceived(xxx.java:360) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:208) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:323) at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:520) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535) at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:714) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657) at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67) at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1121) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "NioProcessor-2" prio=10 tid=0x8c031400 nid=0x4638 waiting on condition [0x8b858000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) parking to wait for <0x989458d0> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source) at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown Source) at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source) at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:313) at org.apache.mina.filter.ssl.SslFilter.filterClose(SslFilter.java:672) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:644) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1600(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:958) at org.apache.mina.core.filterchain.IoFilterAdapter.filterClose(IoFilterAdapter.java:130) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:644) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1600(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterClose(DefaultIoFilterChain.java:958) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterClose(DefaultIoFilterChain.java:882) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterClose(DefaultIoFilterChain.java:644) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterClose(DefaultIoFilterChain.java:637) at org.apache.mina.core.session.AbstractIoSession.close(AbstractIoSession.java:318) at org.apache.mina.core.session.AbstractIoSession.close(AbstractIoSession.java:297) at xxx.messageReceived(xxx.java:360) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:208) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:323) at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:520) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535) at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:714) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657) at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67) at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1121) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "NioProcessor-6" prio=10 tid=0x8c056400 nid=0x4568 in Object.wait() [0x8b6fe000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) waiting on <0x98828a98> (a edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock$NonfairSync) at java.lang.Object.wait(Object.java:485) at edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:199) locked <0x98828a98> (a edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock$NonfairSync) at edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:481) at xxx.messageReceived(xxx.java:360) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:208) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:323) at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:520) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535) at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:714) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657) at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67) at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1121) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "NioProcessor-3" prio=10 tid=0x09033400 nid=0x4565 waiting on condition [0x8eb68000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) parking to wait for <0x989458d0> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source) at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown Source) at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source) at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:313) at org.apache.mina.filter.ssl.SslFilter.filterWrite(SslFilter.java:639) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:625) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1500(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:953) at org.apache.mina.core.filterchain.IoFilterAdapter.filterWrite(IoFilterAdapter.java:123) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:625) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1500(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:953) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterWrite(DefaultIoFilterChain.java:877) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:625) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterWrite(DefaultIoFilterChain.java:618) at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:502) at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:447) at xxx.messageReceived(xxx.java:74) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:323) at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:520) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.proxy.filter.ProxyFilter.messageReceived(ProxyFilter.java:153) locked <0x98935280> (a org.apache.mina.proxy.handlers.socks.Socks5LogicHandler) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943) at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535) at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:714) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657) at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67) at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1121) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "Thread-102" prio=10 tid=0x8c20e000 nid=0x4560 waiting on condition [0x8c1ad000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) parking to wait for <0x988a3ce0> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source) at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown Source) at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source) at org.apache.mina.filter.ssl.SslHandler.flushScheduledEvents(SslHandler.java:313) at org.apache.mina.filter.ssl.SslFilter.filterWrite(SslFilter.java:639) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:625) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1500(DefaultIoFilterChain.java:48) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:953) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterWrite(DefaultIoFilterChain.java:877) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:625) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterWrite(DefaultIoFilterChain.java:618) at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:502) at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:447) at xxx.run(xxx.java:219) at java.lang.Thread.run(Unknown Source)
          Hide
          elecharny Emmanuel Lecharny added a comment - - edited

          The fix applied in DIRMINA-779 obviously is not good.

          It seems like we are protecting the flushScheduledEvents method against concurrent access across many threads - thus the deadlock - while it was initially protecting the write queue and teh receive queue to be messed by another thread.

          It has to be rethought from ground zero...

          Show
          elecharny Emmanuel Lecharny added a comment - - edited The fix applied in DIRMINA-779 obviously is not good. It seems like we are protecting the flushScheduledEvents method against concurrent access across many threads - thus the deadlock - while it was initially protecting the write queue and teh receive queue to be messed by another thread. It has to be rethought from ground zero...
          Hide
          yzb81 yzb81 added a comment -

          I think the true reason of the deadlock is that the established SSL session read data from socket, and my handler write data to the session at the same time. please see the "NioProcessor-3" and "Thread-102" in my last comment.

          this is the closing session code section, just seems ok.
          IoSession tempSession = getSession();
          if(tempSession != null && tempSession.isConnected())

          { tempSession.close(true); }
          Show
          yzb81 yzb81 added a comment - I think the true reason of the deadlock is that the established SSL session read data from socket, and my handler write data to the session at the same time. please see the "NioProcessor-3" and "Thread-102" in my last comment. this is the closing session code section, just seems ok. IoSession tempSession = getSession(); if(tempSession != null && tempSession.isConnected()) { tempSession.close(true); }
          Hide
          yzb81 yzb81 added a comment -

          yes, in 2.0.7 this deadlock only appears when using proxy, but in 2.0.9 it appears everytime no matter using proxy.

          Show
          yzb81 yzb81 added a comment - yes, in 2.0.7 this deadlock only appears when using proxy, but in 2.0.9 it appears everytime no matter using proxy.
          Hide
          elecharny Emmanuel Lecharny added a comment -

          In 2.0.7, the lock was just around the write section, but it was problematic for other reasons. See DIRMINA-779.

          The fix in 2.0.8 obviously is problematic too, as it ties reads and writes.

          Show
          elecharny Emmanuel Lecharny added a comment - In 2.0.7, the lock was just around the write section, but it was problematic for other reasons. See DIRMINA-779 . The fix in 2.0.8 obviously is problematic too, as it ties reads and writes.
          Hide
          elecharny Emmanuel Lecharny added a comment -

          Question : do you have an ExecutorFilter in your chain of filters ?

          Show
          elecharny Emmanuel Lecharny added a comment - Question : do you have an ExecutorFilter in your chain of filters ?
          Hide
          jeffmaury Jeff MAURY added a comment -

          Look at the code: seems user code is launching a thread that performs write operation.
          Seems two filters are in the chain: SslFilter and ProxyFilter. Each of them are synchronized against their underlying handler.
          Seems that filters are not called in the same order for read or write operations thus the lock

          Show
          jeffmaury Jeff MAURY added a comment - Look at the code: seems user code is launching a thread that performs write operation. Seems two filters are in the chain: SslFilter and ProxyFilter. Each of them are synchronized against their underlying handler. Seems that filters are not called in the same order for read or write operations thus the lock
          Hide
          yzb81 yzb81 added a comment -

          Yes, I launched a thread which will write data occasionally,can't do like that?

          Show
          yzb81 yzb81 added a comment - Yes, I launched a thread which will write data occasionally,can't do like that?
          Hide
          jeffmaury Jeff MAURY added a comment -

          Yes, the pattern is correct. We will investigate the lock problem.

          Show
          jeffmaury Jeff MAURY added a comment - Yes, the pattern is correct. We will investigate the lock problem.
          Hide
          yzb81 yzb81 added a comment -

          Now I tried to use session.suspendRead() before I write data in the main thread, the condition seems to be improved, but still have deadlock.

          Show
          yzb81 yzb81 added a comment - Now I tried to use session.suspendRead() before I write data in the main thread, the condition seems to be improved, but still have deadlock.
          Hide
          tevans Tom Evans added a comment -

          Looks like the lock assertion in flushScheduledEvents() is referring to the handler itself ("this") rather than the actual reentrant lock instance.

                  if (Thread.holdsLock(this)) {
                      return;
                  }
          

          I believe this would work better as follows:

              if (sslLock.tryLock()) {
                  // flush
              }
          

          I have attached a patch file from the 2.0 head for this suggested fix.

          Show
          tevans Tom Evans added a comment - Looks like the lock assertion in flushScheduledEvents() is referring to the handler itself ("this") rather than the actual reentrant lock instance. if (Thread.holdsLock(this)) { return; } I believe this would work better as follows: if (sslLock.tryLock()) { // flush } I have attached a patch file from the 2.0 head for this suggested fix.
          Hide
          yzb81 yzb81 added a comment -

          Thanks Evans, I have tried this patch on 2.0.7, it seem's to have solved the problem.

          Show
          yzb81 yzb81 added a comment - Thanks Evans, I have tried this patch on 2.0.7, it seem's to have solved the problem.
          Hide
          elecharny Emmanuel Lecharny added a comment -

          Sorry for the delay, I have to apply the patch on the MINA core for days, and I haven't found a mnute to do so...

          Now that Xmas is approaching, I will most certainly find an hour to get it applied, and to cut a release as soon as it's done.

          Thanks !

          Show
          elecharny Emmanuel Lecharny added a comment - Sorry for the delay, I have to apply the patch on the MINA core for days, and I haven't found a mnute to do so... Now that Xmas is approaching, I will most certainly find an hour to get it applied, and to cut a release as soon as it's done. Thanks !
          Hide
          elecharny Emmanuel Lecharny added a comment -
          Show
          elecharny Emmanuel Lecharny added a comment - Patch applied with http://git-wip-us.apache.org/repos/asf/mina/commit/0b623816 Thanks a lot !

            People

            • Assignee:
              Unassigned
              Reporter:
              yzb81 yzb81
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development