Bug 972444

Summary: Concurrent calling of QueueImpl.deliver() results in duplicated messages
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Yong Hao Gao <hgao>
Component: HornetQAssignee: Clebert Suconic <csuconic>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 6.1.0CC: anmiller, csuconic, mnovak, myarboro
Target Milestone: ER7   
Target Release: EAP 6.1.1   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-16 20:30:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yong Hao Gao 2013-06-09 12:52:25 UTC
Description of problem:

In QueueImpl, when paging involved, the deliver() method maybe concurrent called by different executors (the one in the queue and the one from page subscription). Although either of them is ordered executors, they schedule tasks independently of each other. So there is a chance when both executors are used, each has a thread calling deliver(). This may lead to the message acknowledgement on a consumer out of order and the message delivered more than once.

Version-Release number of selected component (if applicable):


How reproducible:

Run the tests attached to the forum


Actual results:
test failure with many duplicated messages

Expected results:
test pass

Additional info:

Comment 1 JBoss JIRA Server 2013-06-11 09:35:00 UTC
Francisco Borges <francisco.borges> made a comment on jira HORNETQ-1224

Hi Howard, I commented on the case on the forum. If we synchronize {{QueueImpl.deliver()}} on a {{deliveryGuard}}, the tests will pass (and actually run much faster). Something like this ought to fix the case:

{code}
  private final Object deliveryGuard = new Object();

  private void deliver()
   {
      synchronized (deliveryGuard)
      {
        // ....
      }
   }
 {code}

Since you are out on vacation and we are not releasing a new version tomorrow, I'm not sending a PR on this as the fix is yours.

Comment 2 JBoss JIRA Server 2013-06-13 08:34:56 UTC
Yong Hao Gao <hgao> made a comment on jira HORNETQ-1224

Hi Francisco,

As discussed I assigned this task to you. :)

Thanks.

Comment 3 JBoss JIRA Server 2013-06-14 12:42:51 UTC
Francisco Borges <francisco.borges> updated the status of jira HORNETQ-1224 to Resolved

Comment 4 JBoss JIRA Server 2013-06-14 12:42:51 UTC
Francisco Borges <francisco.borges> made a comment on jira HORNETQ-1224

Fix + unit test are merged. Case is fixed.

Comment 5 JBoss JIRA Server 2013-06-20 20:37:47 UTC
Clebert Suconic <clebert.suconic> updated the status of jira HORNETQ-1224 to Closed

Comment 7 Miroslav Novak 2013-08-22 11:29:51 UTC
BZ is in incorrect state. Fix for this issue is present in EAP 6.1.1.ER7(HQ 2.3.5.Final) 

Verified using provided test in EAP 6.1.1.ER7.