Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-995

Deadlock when using SSL and proxy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.7
    • 2.0.10
    • Filter
    • None
    • 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)

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: