Add rtype_cache
to warnings.warn
message when leaked objects found
#106739
Labels
type-feature
A feature request or enhancement
Feature or enhancement
Add the
rtype_cache
(which is aset
that includes all leaked objects of a particular type) to thewarnings.warn
message inLib/multiprocessing/resource_tracker.py
when any leaked objects are found to make debugging easier:cpython/Lib/multiprocessing/resource_tracker.py
Lines 224 to 226 in 490295d
Pitch
When the
resource_tracker
module (Lib/multiprocessing/resource_tracker.py
) finds leaked objects, thefinally
block in themain
function includes the type of leaked objects and the number of leaked objects, but does not actually include the objects that are leaked. Adding theset
ofrtype_cache
to thewarnings.warn
message will make debugging much more useful, as the names of the leaked objects could help more quickly identify what was leaked and/or why the leaked object was not properly cleaned up.The permalink attached above links directly to the relevant code as it is currently implemented, but I'm adding it again below with some surrounding code for reference here:
Previous discussion
A recent example of an issue where the additional context would have been useful is #104090, in which the current warning message is
/workspace/cpython/Lib/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 6 leaked semaphore objects to clean up at shutdown
.Linked PRs
rtype_cache
towarnings.warn
message when leaked objects found #106740The text was updated successfully, but these errors were encountered: