Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
vstinner opened this issue Aug 9, 2017 · 5 comments
Closed

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

vstinner opened this issue Aug 9, 2017 · 5 comments
Labels

Comments

@vstinner
Copy link
Member

vstinner commented Aug 9, 2017

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']

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 9, 2017

    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)

    @vstinner vstinner added 3.7 (EOL) end of life easy labels Aug 9, 2017
    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 9, 2017

    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

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 9, 2017

    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

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 9, 2017

    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

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 9, 2017

    Thank you Ammar Askar for your contribution!

    @vstinner vstinner closed this as completed Aug 9, 2017
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant