apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 43876] New: - Thread pooling has thread safety/race condition errors
Date Thu, 15 Nov 2007 23:32:02 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43876>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43876

           Summary: Thread pooling has thread safety/race condition errors
           Product: APR
           Version: HEAD
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR-util
        AssignedTo: bugs@apr.apache.org
        ReportedBy: Joe.Mudd@sas.com
                CC: henryjen@ztune.net
 BugsThisDependsOn: 42889


The thread pooling code (trunk misc/apr_thread_pool.c) has the following thread 
safety/race condition issues:

1) When a busy thread is trimmed its list element may have had its next and/or
   prev RING linkage nulled out which may cause the subsequent
   APR_RING_REMOVE() in thread_pool_func() crash.
2) The allocation of the thread pool function list element uses apr_pcalloc()
   w/o first serializing the use of the pool.  apr_pcalloc() is not thread-safe
   and the same bit of memory may be handed out more than once.
3) When threads (especially idle ones) are trimmed the lock is not held long
   enough which may allow the list element to be removed more than once (similar
   to #1).  This problem was introduced w/the idle worker timeout enhancement
   detailed in Bug 42889.

Plus, the list element descriptors allocated to track an active worker thread
were leaking.

I have included a patch that has the fixes for these 4 problems.  The patch 
includes the idle timeout and statistic updates in bug 42889.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message