[New-bugs-announce] [issue2302] Uses of SocketServer.BaseServer.shutdown have a race

Jeffrey Yasskin report at bugs.python.org
Sun Mar 16 16:15:57 CET 2008


New submission from Jeffrey Yasskin <jyasskin at gmail.com>:

With the code as it stands, calls to shutdown that happen before
serve_forever enters its loop will deadlock, and there's no simple way
for the user to avoid this. The attached patch prevents the deadlock and
allows multiple serve_forever..shutdown cycles, but it's pretty
complicated. I could make it a lot simpler by making shutdown permanent:
any later serve_forever calls would return immediately.

A third choice would be to add a .serve_in_thread function that returns
a token that can be used to shut down exactly that loop, instead of
putting .shutdown() on the server. Any opinions?

----------
components: Library (Lib)
files: race_free_shutdown.patch
keywords: patch, patch
messages: 63579
nosy: jyasskin
severity: normal
status: open
title: Uses of SocketServer.BaseServer.shutdown have a race
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file9681/race_free_shutdown.patch

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2302>
__________________________________


More information about the New-bugs-announce mailing list