This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: socketserver.shutdown should stop serve_forever() immediately
Type: Stage:
Components: Library (Lib) Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: petr.viktorin
Priority: normal Keywords:

Created on 2021-07-28 21:32 by petr.viktorin, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg398427 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-07-28 21:32
Currently, socketserver.serve_forever() sets a variable and serve_forever() polls for it, with a configurable interval.

A comment in the code already says:
# XXX: Consider using another file descriptor or connecting to the
# socket to wake this up instead of polling. Polling reduces our
# responsiveness to a shutdown request and wastes cpu at all other
# times.
msg398462 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-07-29 07:21
This isn't a high priority for me, but I have a WIP branch in https://github.com/encukou/cpython/tree/http-server-poll
Feel free to continue it if you get to it sooner than I do.
History
Date User Action Args
2022-04-11 14:59:48adminsetgithub: 88932
2021-07-29 07:21:46petr.viktorinsetmessages: + msg398462
2021-07-28 21:32:39petr.viktorincreate