Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.

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>
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   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-16 16:30:48 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Yong Hao Gao 2013-06-09 08:52:25 EDT
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 05:35:00 EDT
Francisco Borges <francisco.borges@redhat.com> 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:

  private final Object deliveryGuard = new Object();

  private void deliver()
      synchronized (deliveryGuard)
        // ....

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 04:34:56 EDT
Yong Hao Gao <hgao@redhat.com> made a comment on jira HORNETQ-1224

Hi Francisco,

As discussed I assigned this task to you. :)

Comment 3 JBoss JIRA Server 2013-06-14 08:42:51 EDT
Francisco Borges <francisco.borges@redhat.com> updated the status of jira HORNETQ-1224 to Resolved
Comment 4 JBoss JIRA Server 2013-06-14 08:42:51 EDT
Francisco Borges <francisco.borges@redhat.com> made a comment on jira HORNETQ-1224

Fix + unit test are merged. Case is fixed.
Comment 5 JBoss JIRA Server 2013-06-20 16:37:47 EDT
Clebert Suconic <clebert.suconic@jboss.com> updated the status of jira HORNETQ-1224 to Closed
Comment 7 Miroslav Novak 2013-08-22 07:29:51 EDT
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.