[New-bugs-announce] [issue31238] pydoc: ServerThread.stop() leaves a dangling thread
report at bugs.python.org
Fri Aug 18 19:50:45 EDT 2017
New submission from STINNER Victor:
When using https://github.com/python/cpython/pull/3138 I see that test_pydoc leaves a dangling thread. The bug comes from test_server() which uses pydoc ServerThread.
ServerThread.stop() and test_pydoc don't join the thread. Moreover, ServerThread.docserver has a reference cycle through the DocServer.callback attribute.
Attached PR modifies ServerThread.stop() to join itself (the thread), to wait until the HTTP server completes, and then explicitly break the reference cycle.
With the PR, pydoc may hang if a bad HTTP client. So another option is to only modify test_pydoc to join() + break the ref cycle.
components: Library (Lib)
title: pydoc: ServerThread.stop() leaves a dangling thread
type: resource usage
versions: Python 3.7
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce