Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 32767 invoked from network); 27 Sep 2010 11:57:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 Sep 2010 11:57:41 -0000 Received: (qmail 51896 invoked by uid 500); 27 Sep 2010 11:57:41 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 51784 invoked by uid 500); 27 Sep 2010 11:57:39 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 51777 invoked by uid 99); 27 Sep 2010 11:57:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Sep 2010 11:57:38 +0000 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; Mon, 27 Sep 2010 11:57:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5885623888EC; Mon, 27 Sep 2010 11:57:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1001685 - /apr/apr/trunk/util-misc/apr_thread_pool.c Date: Mon, 27 Sep 2010 11:57:17 -0000 To: commits@apr.apache.org From: trawick@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100927115717.5885623888EC@eris.apache.org> Author: trawick Date: Mon Sep 27 11:57:17 2010 New Revision: 1001685 URL: http://svn.apache.org/viewvc?rev=1001685&view=rev Log: apr_thread_pool_create: Fix pool corruption caused by multithread use of the pool when multiple initial threads are created. PR: 47843 Submitted by: Alex Korobka Reviewed by: trawick Modified: apr/apr/trunk/util-misc/apr_thread_pool.c Modified: apr/apr/trunk/util-misc/apr_thread_pool.c URL: http://svn.apache.org/viewvc/apr/apr/trunk/util-misc/apr_thread_pool.c?rev=1001685&r1=1001684&r2=1001685&view=diff ============================================================================== --- apr/apr/trunk/util-misc/apr_thread_pool.c (original) +++ apr/apr/trunk/util-misc/apr_thread_pool.c Mon Sep 27 11:57:17 2010 @@ -377,7 +377,13 @@ APR_DECLARE(apr_status_t) apr_thread_poo apr_pool_cleanup_null); while (init_threads) { + /* Grab the mutex as apr_thread_create() and thread_pool_func() will + * allocate from (*me)->pool. This is dangerous if there are multiple + * initial threads to create. + */ + apr_thread_mutex_lock(tp->lock); rv = apr_thread_create(&t, NULL, thread_pool_func, tp, tp->pool); + apr_thread_mutex_unlock(tp->lock); if (APR_SUCCESS != rv) { break; }