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: shutdown() in socketserver.BaseServer should be in a different thread from serve_forever()
Type: Stage: resolved
Components: Documentation Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: amaajemyfren, docs@python, miss-islington, ned.deily
Priority: normal Keywords: patch

Created on 2020-02-29 13:04 by amaajemyfren, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18926 closed amaajemyfren, 2020-03-11 14:59
PR 18929 merged amaajemyfren, 2020-03-11 16:08
PR 18930 closed amaajemyfren, 2020-03-11 16:24
PR 18932 closed amaajemyfren, 2020-03-11 16:34
PR 18933 closed amaajemyfren, 2020-03-11 16:40
PR 19085 merged miss-islington, 2020-03-20 08:03
PR 19086 merged miss-islington, 2020-03-20 08:03
Messages (5)
msg362981 - (view) Author: Ama Aje My Fren (amaajemyfren) * Date: 2020-02-29 13:04
When a subclass of socketserver.BaseServer is running after calling serve_forever() and needs to be shutdown, it may be shut down by sending a [shutdown()](https://docs.python.org/3/library/socketserver.html#socketserver.BaseServer.shutdown). The thing is though that the shutdown() call must be run in a different thread than the one where the serve_forever() was called otherwise it will deadlock. This is documented in the [code](https://github.com/python/cpython/blob/3.8/Lib/socketserver.py#L244) but not in the documentation. It should be in the documentation as well as it is not obvious.
msg364652 - (view) Author: miss-islington (miss-islington) Date: 2020-03-20 08:03
New changeset 2de7ac97981c30e9c1001b05a771f52a41772c54 by amaajemyfren in branch 'master':
bpo-39797 Changes to socketserver.BaseServer's shutdown() method. (GH-18929)
https://github.com/python/cpython/commit/2de7ac97981c30e9c1001b05a771f52a41772c54
msg364653 - (view) Author: miss-islington (miss-islington) Date: 2020-03-20 08:08
New changeset 64937d308c71a5c95627b0a0d0574d164c0cf30a by Miss Islington (bot) in branch '3.7':
bpo-39797 Changes to socketserver.BaseServer's shutdown() method. (GH-18929)
https://github.com/python/cpython/commit/64937d308c71a5c95627b0a0d0574d164c0cf30a
msg364654 - (view) Author: miss-islington (miss-islington) Date: 2020-03-20 08:08
New changeset 29723368e797f36ba8940f25b6e677852b7313b2 by Miss Islington (bot) in branch '3.8':
bpo-39797 Changes to socketserver.BaseServer's shutdown() method. (GH-18929)
https://github.com/python/cpython/commit/29723368e797f36ba8940f25b6e677852b7313b2
msg364655 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-03-20 08:15
Thank you for your PR!
History
Date User Action Args
2022-04-11 14:59:27adminsetgithub: 83978
2020-03-20 08:15:34ned.deilysetstatus: open -> closed

type: enhancement ->
versions: - Python 3.5, Python 3.6
nosy: + ned.deily

messages: + msg364655
resolution: fixed
stage: patch review -> resolved
2020-03-20 08:08:56miss-islingtonsetmessages: + msg364654
2020-03-20 08:08:51miss-islingtonsetmessages: + msg364653
2020-03-20 08:03:42miss-islingtonsetpull_requests: + pull_request18446
2020-03-20 08:03:34miss-islingtonsetpull_requests: + pull_request18445
2020-03-20 08:03:21miss-islingtonsetnosy: + miss-islington
messages: + msg364652
2020-03-11 16:40:12amaajemyfrensetpull_requests: + pull_request18285
2020-03-11 16:34:22amaajemyfrensetpull_requests: + pull_request18284
2020-03-11 16:24:06amaajemyfrensetpull_requests: + pull_request18282
2020-03-11 16:08:09amaajemyfrensetpull_requests: + pull_request18281
2020-03-11 14:59:05amaajemyfrensetkeywords: + patch
stage: patch review
pull_requests: + pull_request18278
2020-02-29 13:04:26amaajemyfrencreate