From dev-return-99519-apmail-cocoon-dev-archive=cocoon.apache.org@cocoon.apache.org Fri Jun 06 23:05:07 2008 Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 10416 invoked from network); 6 Jun 2008 23:05:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Jun 2008 23:05:06 -0000 Received: (qmail 797 invoked by uid 500); 6 Jun 2008 23:05:09 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 514 invoked by uid 500); 6 Jun 2008 23:05:08 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 498 invoked by uid 99); 6 Jun 2008 23:05:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jun 2008 16:05:08 -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, 06 Jun 2008 23:04:27 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id EDFCC234C133 for ; Fri, 6 Jun 2008 16:04:44 -0700 (PDT) Message-ID: <1174804165.1212793484961.JavaMail.jira@brutus> Date: Fri, 6 Jun 2008 16:04:44 -0700 (PDT) From: "Antonio Gallardo (JIRA)" To: dev@cocoon.apache.org Subject: [jira] Commented: (COCOON-2208) Race condition in AbstractCachingProcessingPipeline causes threads to hang. In-Reply-To: <817350192.1212771825120.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/jira/browse/COCOON-2208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603216#action_12603216 ] Antonio Gallardo commented on COCOON-2208: ------------------------------------------ Is not the same as: https://issues.apache.org/jira/browse/COCOON-1985 ? > Race condition in AbstractCachingProcessingPipeline causes threads to hang. > --------------------------------------------------------------------------- > > Key: COCOON-2208 > URL: https://issues.apache.org/jira/browse/COCOON-2208 > Project: Cocoon > Issue Type: Bug > Components: * Cocoon Core > Affects Versions: 2.1.11 > Reporter: Sylvain Wallez > Priority: Blocker > > There's a race condition in AbstractCachingProcessingPipeline.waitForLock() : if "lock" is not null, there is a possibility that the thread that created the lock releases it before the current thread starts waiting on it (see below). When this happens, the thread waits forever since no thread will ever call notify() on the lock. > The very bad effect is that this progressively blocks the entire thread pool of the servlet engine, which ends up rejecting new incoming connections. > And BTW, calling containsKey() just before get() unneedingly doubles the number of lookups. > {noformat} > protected boolean waitForLock(Object key) { > if(transientStore != null) { > Object lock = null; > synchronized(transientStore) { > String lockKey = PIPELOCK_PREFIX+key; > if(transientStore.containsKey(lockKey)) { > // cache content is currently being generated, wait for other thread > lock = transientStore.get(lockKey); > } > } > // START OF RACE CONDITION ZONE > if(lock != null) { > try { > // become owner of monitor > synchronized(lock) { > // END OF RACE CONDITION ZONE > lock.wait(); > } > } catch (InterruptedException e) { > if(getLogger().isDebugEnabled()) { > getLogger().debug("Got interrupted waiting for other pipeline to finish processing, retrying...",e); > } > return false; > } > if(getLogger().isDebugEnabled()) { > getLogger().debug("Other pipeline finished processing, retrying to get cached response."); > } > return false; > } > } > return true; > } > {noformat} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.