[New-bugs-announce] [issue26392] socketserver.BaseServer.close_server should stop serve_forever

Aviv Palivoda report at bugs.python.org
Fri Feb 19 12:00:17 EST 2016

New submission from Aviv Palivoda:

Currently if you call server_close you only close the socket. If we  called serve_forever and then call server_close without calling shutdown the serve_forever loop keep running. Before using the selectors module for doing the poll we would have had exception thrown from the select (The socket fd is -1) in serve_forever.
IMO you should be able to call server_close at any time and expect it to stop the serve_forever. Maybe even adding a block option to server_close that will wait on the server_forever if it's running (waiting for issue 12463 to resolve before doing this).
Added a patch that closes serve_forever if server_close is called.

components: Library (Lib)
files: socketserver_close_stop_serve_forever.patch
keywords: patch
messages: 260524
nosy: palaviv
priority: normal
severity: normal
status: open
title: socketserver.BaseServer.close_server should stop serve_forever
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41971/socketserver_close_stop_serve_forever.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list