You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/06/02 13:51:00 UTC

[jira] [Work logged] (AMQ-8287) Deadlock caused by synchronized on serviceRead() in NIOSSLTransport

     [ https://issues.apache.org/jira/browse/AMQ-8287?focusedWorklogId=605202&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-605202 ]

ASF GitHub Bot logged work on AMQ-8287:
---------------------------------------

                Author: ASF GitHub Bot
            Created on: 02/Jun/21 13:50
            Start Date: 02/Jun/21 13:50
    Worklog Time Spent: 10m 
      Work Description: cshannon opened a new pull request #666:
URL: https://github.com/apache/activemq/pull/666


   This narrows the lock that was added to serviceRead() to secureRead()
   which prevents processing commands while locked which should solve the
   deadlock issues


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 605202)
    Remaining Estimate: 0h
            Time Spent: 10m

> Deadlock caused by synchronized on serviceRead() in NIOSSLTransport
> -------------------------------------------------------------------
>
>                 Key: AMQ-8287
>                 URL: https://issues.apache.org/jira/browse/AMQ-8287
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.15.15, 5.16.2
>            Reporter: Christopher L. Shannon
>            Assignee: Christopher L. Shannon
>            Priority: Major
>             Fix For: 5.17.0, 5.16.3
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> I ran into a deadlock caused by the fix for AMQ-8169 when using Stomp NIOSSLTransport (but it could probably happen for other nio ssl transports)
> The newly added synchronized on the serviceRead() caused a deadlock between the transport and the TransportConnection. One thread acquired a lock on the TransportConnection and was waiting on serviceRead() to acquire the NIOSSLTransport lock. Another thread had was inside serviceRead() so it acquired the NIOSSLTransport lock and was then later waiting for the TransportConnection lock.
> The main issue is that processCommand(plain) ends up being protected by the lock and since there's multiple brokers/filters running we run into a deadlock (my current deadlock happened processing a ConsumerInfo command)
> To fix this we simply need to narrow the lock as it's too broad. The goal here was to protect the the reading off the channel concurrently (so really the secureRead() method so we can move the lock to secureRead() and not lock the entire serviceRead() call and that should fix the deadlock problem while still solving the initial issue which was demonstrated by the StompNIOSSL failing before this fix. I will open a new Jira shortly and push a fix.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)