Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 55142 invoked from network); 6 Jun 2008 17:04:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Jun 2008 17:04:07 -0000 Received: (qmail 44344 invoked by uid 500); 6 Jun 2008 17:04:08 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 44229 invoked by uid 500); 6 Jun 2008 17:04: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 44217 invoked by uid 99); 6 Jun 2008 17:04: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 10:04: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 17:03:27 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 1DBC9234C136 for ; Fri, 6 Jun 2008 10:03:45 -0700 (PDT) Message-ID: <817350192.1212771825120.JavaMail.jira@brutus> Date: Fri, 6 Jun 2008 10:03:45 -0700 (PDT) From: "Sylvain Wallez (JIRA)" To: dev@cocoon.apache.org Subject: [jira] Created: (COCOON-2208) Race condition in AbstractCachingProcessingPipeline causes threads to hang. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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.