Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 71974 invoked from network); 25 Apr 2008 06:12:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Apr 2008 06:12:16 -0000 Received: (qmail 96594 invoked by uid 500); 25 Apr 2008 06:12:16 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 96526 invoked by uid 500); 25 Apr 2008 06:12:16 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 96509 invoked by uid 99); 25 Apr 2008 06:12:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 23:12:16 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 06:11:31 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8164A234C103 for ; Thu, 24 Apr 2008 23:08:43 -0700 (PDT) Message-ID: <1696631995.1209103723525.JavaMail.jira@brutus> Date: Thu, 24 Apr 2008 23:08:43 -0700 (PDT) From: "Rob Davies (JIRA)" To: dev@activemq.apache.org Subject: [jira] Assigned: (AMQ-1686) Small window in wakeup logic for PooledTaskRunner - task can get executed in parallell In-Reply-To: <357886541.1209054643461.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/AMQ-1686?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Rob Davies reassigned AMQ-1686: ------------------------------- Assignee: Rob Davies > Small window in wakeup logic for PooledTaskRunner - task can get executed in parallell > -------------------------------------------------------------------------------------- > > Key: AMQ-1686 > URL: https://issues.apache.org/activemq/browse/AMQ-1686 > Project: ActiveMQ > Issue Type: Bug > Components: Broker > Affects Versions: 5.0.0 > Environment: windows XP > Reporter: Gary Tully > Assignee: Rob Davies > Fix For: 5.1.0 > > Attachments: AMQ-1689.patch > > > org.apache.activemq.broker.region.cursors.CursorDurableTest fails on windows sometimes with the error: > Exception in thread "Persistence Adaptor Task" java.lang.NullPointerException > at org.apache.activemq.store.amq.AMQMessageStore$4.execute(AMQMessageStore.java:381) > at org.apache.activemq.util.TransactionTemplate.run(TransactionTemplate.java:44) > at org.apache.activemq.store.amq.AMQMessageStore.doAsyncWrite(AMQMessageStore.java:374) > at org.apache.activemq.store.amq.AMQMessageStore.asyncWrite(AMQMessageStore.java:341) > at org.apache.activemq.store.amq.AMQMessageStore$1.iterate(AMQMessageStore.java:95) > at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122) > at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43) > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) > at java.lang.Thread.run(Thread.java:595) > Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 303.672 sec <<< FAILURE! > The problem appears to be in the interaction between wakup and runTask in PooledTaskRunner > iterating is set to false in a finally and queued is checked in a separate sync block. > if wakeup is called in this window, it can set queued and find iterating false so it will execute, and runTask will find queued true and it too will execute. > the fix is to include the queued check in the finally block so that iterating and queued are checked at the same time. I will attach a patch with this fix. > I attempted to reproduce this problem with a unit test but I did not have any real success. the window is quite small. I will include the unit test in case it can be improved upon. > chirino merged a fix yesterday that addresses the symptom of this issue in a different way, > http://svn.apache.org/viewvc?view=rev&revision=650956 > The added synchronisation means that parallel calls by the PooledTaskRunner.asyncWrite are serialised on the method access. > This fix addresses the route cause and can negate the need for the synchronisation. > fyi: In the test, the paralell calls can come from flush() and from the asyncWrite task. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.