Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 49166 invoked from network); 4 Jul 2008 07:25:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jul 2008 07:25:46 -0000 Received: (qmail 63857 invoked by uid 500); 4 Jul 2008 07:25:45 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 63800 invoked by uid 500); 4 Jul 2008 07:25:45 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 63789 invoked by uid 500); 4 Jul 2008 07:25:45 -0000 Delivered-To: apmail-jakarta-tomcat-dev@jakarta.apache.org Received: (qmail 63786 invoked by uid 99); 4 Jul 2008 07:25:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jul 2008 00:25:45 -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.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jul 2008 07:25:02 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E0D41238899B; Fri, 4 Jul 2008 00:25:23 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r673933 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/catalina/core/StandardWrapper.java Date: Fri, 04 Jul 2008 07:25:23 -0000 To: tomcat-dev@jakarta.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080704072523.E0D41238899B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: markt Date: Fri Jul 4 00:25:22 2008 New Revision: 673933 URL: http://svn.apache.org/viewvc?rev=673933&view=rev Log: Another fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=43683 This isn't perfect but it narrows the window for the race condition significantly. A perfect fix would require syncing most (all?) of allocate() which is on the critical path. Modified: tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=673933&r1=673932&r2=673933&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Fri Jul 4 00:25:22 2008 @@ -38,14 +38,6 @@ +1: markt, fhanik -1: -* Another fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=43683 - This isn't perfect but it narrows the window for the race condition - significantly. A perfect fix would require syncing most (all?) of allocate() - which is on the critical path. - http://svn.apache.org/viewvc?rev=672397&view=rev - +1: markt, fhanik, remm - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=36155 Port the fix from the JK Connector to the AJP and APR Connectors http://svn.apache.org/viewvc?rev=672454&view=rev Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java?rev=673933&r1=673932&r2=673933&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java Fri Jul 4 00:25:22 2008 @@ -792,6 +792,8 @@ throw new ServletException (sm.getString("standardWrapper.unloading", getName())); + boolean newInstance = false; + // If not SingleThreadedModel, return the same instance every time if (!singleThreadModel) { @@ -804,6 +806,12 @@ log.debug("Allocating non-STM instance"); instance = loadServlet(); + // For non-STM, increment here to prevent a race + // condition with unload. Bug 43683, test case #3 + if (!singleThreadModel) { + newInstance = true; + countAllocated++; + } } catch (ServletException e) { throw e; } catch (Throwable e) { @@ -817,10 +825,13 @@ if (!singleThreadModel) { if (log.isTraceEnabled()) log.trace(" Returning non-STM instance"); - countAllocated++; + // For new instances, count will have been incremented at the + // time of creation + if (!newInstance) { + countAllocated++; + } return (instance); } - } synchronized (instancePool) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org