Skip to content

thread reaping is imperfect #51471

Closed
Closed

Description

@pitrou
BPO 7222
Nosy @pitrou, @bitdancer
Files
  • threading_setup.patch
  • threading_setup2.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2009-10-30.17:25:52.452>
    created_at = <Date 2009-10-27.21:24:22.709>
    labels = ['type-bug', 'tests']
    title = 'thread reaping is imperfect'
    updated_at = <Date 2009-10-30.17:25:52.450>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2009-10-30.17:25:52.450>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-10-30.17:25:52.452>
    closer = 'pitrou'
    components = ['Tests']
    creation = <Date 2009-10-27.21:24:22.709>
    creator = 'pitrou'
    dependencies = []
    files = ['15215', '15217']
    hgrepos = []
    issue_num = 7222
    keywords = ['patch']
    message_count = 5.0
    messages = ['94582', '94584', '94586', '94592', '94716']
    nosy_count = 3.0
    nosy_names = ['nnorwitz', 'pitrou', 'r.david.murray']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue7222'
    versions = ['Python 2.7', 'Python 3.2']

    Activity

    1. pitrou commented on Oct 27, 2009

      @pitrou
      MemberAuthor

      Thread reaping in test_support is imperfect because, even when a thread
      has a disappeared from _active and _limbo, the Thread object might still
      be hanging somewhere in memory (leaving its last instants). This problem
      manifests itself when trying to fix the transient refleaks in
      test_socketserver.

      One solution I've found is to add a _count() method to the thread
      module, which returns the number of running threads from the point of
      view of the C extension. When _count() is decremented, we can be sure
      the Python method has finished running and the Thread object is not
      hanging around.

    2. added
      testsTests in the Lib/test dir
      type-bugAn unexpected behavior, bug, or error
      on Oct 27, 2009
    3. pitrou commented on Oct 27, 2009

      @pitrou
      MemberAuthor

      Thinking about it, another possibility is to strengthen Thread.join(),
      so that it waits for the actual end of the thread, not a small instant
      before.

    4. pitrou commented on Oct 27, 2009

      @pitrou
      MemberAuthor

      Forget the last message. While improving Thread.join() can be good, it
      still doesn't guarantee that all references have been released.

    5. pitrou commented on Oct 27, 2009

      @pitrou
      MemberAuthor

      Here's a new patch with tests.

    6. pitrou commented on Oct 30, 2009

      @pitrou
      MemberAuthor

      Committed in r75958, r75959.

    7. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions