You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Christopher L. Shannon (JIRA)" <ji...@apache.org> on 2016/12/16 18:39:58 UTC

[jira] [Created] (AMQ-6545) Deadlock can occur during Ack compaction

Christopher L. Shannon created AMQ-6545:
-------------------------------------------

             Summary: Deadlock can occur during Ack compaction
                 Key: AMQ-6545
                 URL: https://issues.apache.org/jira/browse/AMQ-6545
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 5.14.2
            Reporter: Christopher L. Shannon
            Assignee: Christopher L. Shannon


There is an issue in the KahaDB Journal that can cause a deadlock.  I saw the issue occur today when an Ack compaction was running while another thread retrieved the current data file and a rotation was required.

https://issues.apache.org/jira/browse/AMQ-5603 introduced async preallocation and part of that commit introduced two locks instead of 1...dataFileIdLock and currentDataFile.

The issue is that most of the time dataFileIdLock is acquired first and then currentDataFile.  However, when calling the getCurrentDataFile() method if a rotation is needed then the currentDataFile lock is acquired before dataFileIdLock leading to a potential deadlock situation.

The fix is to make sure that the two locks are always acquired in the same order.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)