Skip to content

[EASY] test_thread: Warning -- reap_children() reaped child process #75333

Closed

Description

@vstinner
BPO 31150
Nosy @vstinner
PRs
  • bpo-31150: Wait for child process in test_forkinthread #3032
  • [3.6] bpo-31150: Backport test_forkinthread warnings fix #3041
  • [2.7] bpo-31150: Backport test_forkinthread warnings fix #3042
  • 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 2017-08-09.14:59:51.339>
    created_at = <Date 2017-08-09.00:35:37.945>
    labels = ['easy', '3.7']
    title = '[EASY] test_thread: Warning -- reap_children() reaped child process'
    updated_at = <Date 2017-08-09.14:59:51.338>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2017-08-09.14:59:51.338>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-08-09.14:59:51.339>
    closer = 'vstinner'
    components = []
    creation = <Date 2017-08-09.00:35:37.945>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31150
    keywords = ['easy']
    message_count = 5.0
    messages = ['299958', '299978', '300013', '300014', '300015']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = ['3032', '3041', '3042']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue31150'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7']

    Activity

    1. vstinner commented on Aug 9, 2017

      @vstinner
      MemberAuthor

      It seems like an unit test of test_thread leaks a process. A bisection found the following 2 tests are enough to get the warning:

      • test.test_thread.TestForkInThread.test_forkinthread
      • test.test_thread.LockTests.test_acquire_contended

      I bet that test_forkinthread() doesn't wait correctly for the child process (fork) completion using os.waitpid() or something like that.

      Example 1 (from Refleak buildbot):

      haypo@selma$ ./python -m test -R 3:3 test_thread
      Run tests sequentially
      0:00:00 load avg: 0.55 [1/1] test_thread
      beginning 6 repetitions
      123456
      Warning -- reap_children() reaped child process 6984
      .Warning -- reap_children() reaped child process 7054
      .Warning -- reap_children() reaped child process 7125
      .Warning -- reap_children() reaped child process 7195
      .Warning -- reap_children() reaped child process 7266
      .Warning -- reap_children() reaped child process 7336
      .
      1 test OK.

      Total duration: 5 sec
      Tests result: SUCCESS

      Example 2 (only run the 2 methods):

      haypo@selma$ ./python -m test -m test.test_thread.TestForkInThread.test_forkinthread -m test.test_thread.LockTests.test_acquire_contended -v test_thread test_thread

      0:00:00 load avg: 0.27 [1/2] test_thread
      test_acquire_contended (test.test_thread.LockTests) ... ok
      test_forkinthread (test.test_thread.TestForkInThread) ... ok

      ----------------------------------------------------------------------
      Ran 2 tests in 0.037s

      OK
      0:00:00 load avg: 0.27 [2/2] test_thread
      test_acquire_contended (test.test_thread.LockTests) ... Warning -- reap_children() reaped child process 10613
      ok
      test_forkinthread (test.test_thread.TestForkInThread) ... ok

      ----------------------------------------------------------------------
      Ran 2 tests in 0.036s

      OK
      test_thread failed (env changed)

    2. vstinner commented on Aug 9, 2017

      @vstinner
      MemberAuthor

      New changeset 88eee44 by Victor Stinner (Ammar Askar) in branch 'master':
      bpo-31150: Wait for child process in test_forkinthread to avoid thread reaped warnings (bpo-3032)
      88eee44

    3. vstinner commented on Aug 9, 2017

      @vstinner
      MemberAuthor

      New changeset 425680b by Victor Stinner (Ammar Askar) in branch '2.7':
      [2.7] bpo-31150: Wait for child process in test_forkinthread to avoid thread reaped warnings (bpo-3042)
      425680b

    4. vstinner commented on Aug 9, 2017

      @vstinner
      MemberAuthor

      New changeset 4388b42 by Victor Stinner (Ammar Askar) in branch '3.6':
      [3.6] bpo-31150: Wait for child process in test_forkinthread to avoid thread reaped warnings (bpo-3041)
      4388b42

    5. vstinner commented on Aug 9, 2017

      @vstinner
      MemberAuthor

      Thank you Ammar Askar for your contribution!

    6. 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

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions