Return-Path: Delivered-To: apmail-apr-bugs-archive@www.apache.org Received: (qmail 34250 invoked from network); 5 Aug 2010 12:25:07 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Aug 2010 12:25:07 -0000 Received: (qmail 84137 invoked by uid 500); 5 Aug 2010 12:25:07 -0000 Delivered-To: apmail-apr-bugs-archive@apr.apache.org Received: (qmail 84098 invoked by uid 500); 5 Aug 2010 12:25:06 -0000 Mailing-List: contact bugs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@apr.apache.org Delivered-To: mailing list bugs@apr.apache.org Received: (qmail 84089 invoked by uid 99); 5 Aug 2010 12:25:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Aug 2010 12:25:05 +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.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Aug 2010 12:25:03 +0000 Received: from thor.apache.org (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o75COfkY027873 for ; Thu, 5 Aug 2010 12:24:41 GMT Received: (from daemon@localhost) by thor.apache.org (8.13.8+Sun/8.13.8/Submit) id o75COfgk027872; Thu, 5 Aug 2010 08:24:41 -0400 (EDT) Date: Thu, 5 Aug 2010 08:24:41 -0400 (EDT) From: bugzilla@apache.org To: bugs@apr.apache.org Subject: DO NOT REPLY [Bug 49709] New: apr_thread_pool_push may fail to wake up a thread in the thread pool X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: APR X-Bugzilla-Component: APR-util X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: Joe.Mudd@sas.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: bugs@apr.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=49709 Summary: apr_thread_pool_push may fail to wake up a thread in the thread pool Product: APR Version: HEAD Platform: All OS/Version: All Status: NEW Severity: major Priority: P2 Component: APR-util AssignedTo: bugs@apr.apache.org ReportedBy: Joe.Mudd@sas.com Created an attachment (id=25844) --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25844) apr_thread_pool.c patch I have observed the following race condition between add_task() and thread_pool_func(). If thread_pool_func() owns the me->lock and determines that there is no more work in the task list, the thread will insert itself on the idle list then it will enter wait. Before entering wait, thread_pool_func() releases me->lock then attempts to acquire conditional related me->cond_lock. If add_task() is blocked on me->lock while thread_pool_func() is placing itself on the idle list, add_task() may acquire me->lock as soon as thread_pool_func() releases it. When add_task() is able to beat the single thread pool thread in thread_pool_func() in its acquisition of the conditional related me->cond_lock, we end up with work in the thread pool and no awake threads to process the work. Depending on the application, this may cause an infinite wait for the work to complete. The attached patch changes all condition activity to make use of the main data structure lock (me->lock) instead of the conditional lock (me->cond_lock). That way the addition of work and waking a thread becomes an atomic operation. As well as the placement of a thread in the idle list and waiting for more work. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org For additional commands, e-mail: bugs-help@apr.apache.org