Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Addrtype_cache towarnings.warn message when leaked objects found #106739

Closed
Labels
type-featureA feature request or enhancement
@shailshouryya

Description

@shailshouryya

Feature or enhancement

Add thertype_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:

warnings.warn('resource_tracker: There appear to be %d '
'leaked %s objects to clean up at shutdown'%
(len(rtype_cache),rtype))

Pitch

When theresource_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:

    finally:        # all processes have terminated; cleanup any remaining resources        for rtype, rtype_cache in cache.items():            if rtype_cache:                try:                    warnings.warn('resource_tracker: There appear to be %d '                                  'leaked %s objects to clean up at shutdown' %                                  (len(rtype_cache), rtype))                except Exception:                    pass

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp