You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2009/11/01 08:42:22 UTC
DO NOT REPLY [Bug 48094] New: Avoid a race condition by suspending
worker threads before closing worker sockets
https://issues.apache.org/bugzilla/show_bug.cgi?id=48094
Summary: Avoid a race condition by suspending worker threads
before closing worker sockets
Product: Apache httpd-2
Version: 2.3-HEAD
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: worker
AssignedTo: bugs@httpd.apache.org
ReportedBy: bojan@rexursive.com
Created an attachment (id=24449)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=24449)
(Hopefully) safe close_worker_sockets()
Current code closes worker sockets in close_worker_sockets() from the listener
thread without suspending the workers. At the same time, worker threads may be
in the process of doing the same (they may even set worker_sockets[i] to NULL,
causing a segfault in the listener), potentially causing problems.
The attached patch suspends worker threads first and then shuts down sockets,
using shutdown(). This way, worker threads can still proceed later with regular
close, without any side effects.
--
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@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 48094] Avoid a race condition by suspending worker
threads before closing worker sockets
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48094
Arkadiusz Miskiewicz <ar...@pld-linux.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |arekm@pld-linux.org
--
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@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 48094] Avoid a race condition by suspending worker
threads before closing worker sockets
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48094
Bojan Smojver <bo...@rexursive.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #24450|0 |1
is obsolete| |
--- Comment #4 from Bojan Smojver <bo...@rexursive.com> 2009-11-01 14:48:00 UTC ---
Created an attachment (id=24454)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=24454)
Same for 2.2.x
--
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@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 48094] Avoid a race condition by suspending worker
threads before closing worker sockets
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48094
--- Comment #1 from Bojan Smojver <bo...@rexursive.com> 2009-11-01 00:42:43 UTC ---
Created an attachment (id=24450)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=24450)
Same for 2.2.x
--
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@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 48094] Avoid a race condition by suspending worker
threads before closing worker sockets
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48094
Bojan Smojver <bo...@rexursive.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #24449|0 |1
is obsolete| |
--- Comment #3 from Bojan Smojver <bo...@rexursive.com> 2009-11-01 14:47:34 UTC ---
Created an attachment (id=24453)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=24453)
(Hopefully) safe close_worker_sockets()
Somewhat simpler and more Unixy patch, using sigsuspend() and atomic counters.
--
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@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 48094] Avoid a race condition in
close_worker_sockets()
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48094
Bojan Smojver <bo...@rexursive.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #24454|0 |1
is obsolete| |
--- Comment #6 from Bojan Smojver <bo...@rexursive.com> 2009-11-10 02:12:13 UTC ---
Created an attachment (id=24511)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=24511)
Same for 2.2.x
--
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@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 48094] Avoid a race condition by suspending worker
threads before closing worker sockets
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48094
Bojan Smojver <bo...@rexursive.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #24449|application/octet-stream |text/plain
mime type| |
Attachment #24449|0 |1
is patch| |
--
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@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 48094] Avoid a race condition in
close_worker_sockets()
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48094
Bojan Smojver <bo...@rexursive.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #24453|0 |1
is obsolete| |
--- Comment #5 from Bojan Smojver <bo...@rexursive.com> 2009-11-10 02:11:46 UTC ---
Created an attachment (id=24510)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=24510)
(Hopefully) safe close_worker_sockets()
Simpler and safer patch. Instead of suspending workers (which may hang the
server in some corner cases), we simply send signals to worker threads. Once
the signal handler is executed for a worker thread, we are guaranteed that the
other worker code isn't going to be executing, so we avoid the race.
--
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@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 48094] Avoid a race condition by suspending worker
threads before closing worker sockets
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48094
--- Comment #2 from Bojan Smojver <bo...@rexursive.com> 2009-11-01 00:44:29 UTC ---
Please note, I actually tested the 2.2.x patch. The patch against trunk has
been edited to apply.
--
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@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 48094] Avoid a race condition in
close_worker_sockets()
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48094
Bojan Smojver <bo...@rexursive.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Avoid a race condition by |Avoid a race condition in
|suspending worker threads |close_worker_sockets()
|before closing worker |
|sockets |
--
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@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org