Worker MPM: fix race condition
PR44402: reported and fixed by Basant Kumar Kukreja
* Second part of fix for PR 44402:
- Fix the same race condition in event MPM.
- Slightly optimize code in worker MPM by removing the need for an additional
dereference operation.
- Do some word smithing on the CHANGES entry.
PR: 44402
Submitted by: Basant Kumar Kukreja <basant.kukreja sun.com>
Reviewed by: rpluem
* Add hint to PR in comment. No functional change.
Reviewed by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@631362
13f79535-47bb-0310-9956-
ffa450edef68
-*- coding: utf-8 -*-
Changes with Apache 2.2.9
+ *) Worker / Event MPM: Fix race condition in pool recycling that leads to
+ segmentation faults under load. PR 44402
+ [Basant Kumar Kukreja <basant.kukreja sun.com>]
+
*) mod_proxy_ftp: Fix base for directory listings.
PR 27834 [Nick Kew]
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * Worker and Event MPMs: Fix race condition in pool recycling
- PR 44402
- http://svn.apache.org/viewvc?rev=630335&view=rev
- http://svn.apache.org/viewvc?rev=630348&view=rev
- http://svn.apache.org/viewvc?rev=630350&view=rev
- +1: niq, rpluem, jim
-
* Don't add bogus duplicate Content-Language entries to generated output
PR 11035
http://svn.apache.org/viewvc?rev=611475&view=rev
(*new_recycle));
new_recycle->pool = pool_to_recycle;
for (;;) {
- new_recycle->next = queue_info->recycled_pools;
+ /*
+ * Save queue_info->recycled_pool in local variable next because
+ * new_recycle->next can be changed after apr_atomic_casptr
+ * function call. For gory details see PR 44402.
+ */
+ struct recycled_pool *next = queue_info->recycled_pools;
+ new_recycle->next = next;
if (apr_atomic_casptr
((volatile void **) &(queue_info->recycled_pools),
- new_recycle, new_recycle->next) == new_recycle->next) {
+ new_recycle, next) == next) {
break;
}
}
sizeof(*new_recycle));
new_recycle->pool = pool_to_recycle;
for (;;) {
- new_recycle->next = queue_info->recycled_pools;
+ /* Save queue_info->recycled_pool in local variable next because
+ * new_recycle->next can be changed after apr_atomic_casptr
+ * function call. For gory details see PR 44402.
+ */
+ struct recycled_pool *next = queue_info->recycled_pools;
+ new_recycle->next = next;
if (apr_atomic_casptr((volatile void**)&(queue_info->recycled_pools),
- new_recycle, new_recycle->next) ==
- new_recycle->next) {
+ new_recycle, next) == next) {
break;
}
}