Skip to content

test_multiprocessing_spawn leaks QueueManager dangling processes #91231

Closed

Description

@vstinner
BPO 47075
Nosy @vstinner, @pablogsal, @erlend-aasland
PRs
  • bpo-47075: Add shutdown_timeout to multiprocessing BaseManager #32112
  • Files
  • manager_timeout.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 = None
    created_at = <Date 2022-03-21.03:01:30.369>
    labels = ['tests', '3.11']
    title = 'test_multiprocessing_spawn leaks QueueManager dangling processes'
    updated_at = <Date 2022-03-25.11:40:41.516>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2022-03-25.11:40:41.516>
    actor = 'vstinner'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Tests']
    creation = <Date 2022-03-21.03:01:30.369>
    creator = 'vstinner'
    dependencies = []
    files = ['50694']
    hgrepos = []
    issue_num = 47075
    keywords = ['patch']
    message_count = 4.0
    messages = ['415650', '415651', '415652', '415996']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'pablogsal', 'erlendaasland']
    pr_nums = ['32112']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue47075'
    versions = ['Python 3.11']

    Activity

    1. vstinner commented on Mar 21, 2022

      @vstinner
      MemberAuthor

      Apply attached manager_timeout.patch and run the command:

      ./python -m test --fail-env-changed test_multiprocessing_spawn -v -m test_rapid_restart -F -j4
      

      If you fail to reproduce the issue, replace -j4 with -j10 or use a larger number of concurrent jobs.

      Output:
      ---
      (...)
      0:00:00 load avg: 2.85 Run tests in parallel using 4 child processes
      0:00:06 load avg: 3.02 [ 1/1] test_multiprocessing_spawn failed (env changed)
      test_rapid_restart (test.test_multiprocessing_spawn.WithManagerTestManagerRestart) ... ok

      test_rapid_restart (test.test_multiprocessing_spawn.WithProcessesTestManagerRestart) ... ok
      Warning -- Dangling processes: {<SpawnProcess name='QueueManager-5' pid=438355 parent=438255 stopped exitcode=-SIGTERM>, <SpawnProcess name='QueueManager-7' pid=438395 parent=438255 stopped exitcode=-SIGTERM>}

      test_rapid_restart (test.test_multiprocessing_spawn.WithThreadsTestManagerRestart) ... ok
      Warning -- Dangling processes: {<SpawnProcess name='QueueManager-8' pid=438423 parent=438255 stopped exitcode=-SIGTERM>, <SpawnProcess name='QueueManager-9' pid=438456 parent=438255 stopped exitcode=-SIGTERM>}
      Warning -- Dangling processes: {<SpawnProcess name='QueueManager-8' pid=438423 parent=438255 stopped exitcode=-SIGTERM>, <SpawnProcess name='QueueManager-9' pid=438456 parent=438255 stopped exitcode=-SIGTERM>}

      ----------------------------------------------------------------------
      Ran 3 tests in 5.404s

      OK
      Kill <TestWorkerProcess #2 running test=test_multiprocessing_spawn pid=438256 time=6.9 sec> process group
      Kill <TestWorkerProcess #3 running test=test_multiprocessing_spawn pid=438259 time=6.9 sec> process group
      Kill <TestWorkerProcess #4 running test=test_multiprocessing_spawn pid=438260 time=6.9 sec> process group

      == Tests result: ENV CHANGED ==

      1 test altered the execution environment:
      test_multiprocessing_spawn

      (...)
      ---

      Examples of similar old issues:

      See also the old fixed bpo-31234 "Make support.threading_cleanup() stricter".

    2. added
      3.11only security fixes
      testsTests in the Lib/test dir
      on Mar 21, 2022
    3. vstinner commented on Mar 21, 2022

      @vstinner
      MemberAuthor

      BaseManager._finalize_manager() timeout should be configurable, the test should use the same timeout than support.wait_process() (SHORT_TIMEOUT), and maybe the default timeout should be increased?

      I propose to use the same timeout for the two process.join(timeout=xxx) calls (before/after terminate).

    4. vstinner commented on Mar 21, 2022

      @vstinner
      MemberAuthor

      Recent failures.

      AMD64 FreeBSD Non-Debug 3.x:
      https://buildbot.python.org/all/#/builders/172/builds/1654
      ---
      Warning -- Dangling processes: {<SpawnProcess name='QueueManager-335' pid=15699 parent=14154 stopped exitcode=-SIGTERM>}
      Warning -- Dangling processes: {<SpawnProcess name='QueueManager-335' pid=15699 parent=14154 stopped exitcode=-SIGTERM>}

      1 test altered the execution environment:
      test_multiprocessing_spawn
      ---

    5. vstinner commented on Mar 25, 2022

      @vstinner
      MemberAuthor

      BaseManager._finalize_manager() timeout should be configurable

      I proposed #32112 for that.

    6. transferred this issue fromon Apr 10, 2022
    7. added 2 commits that reference this issue on Apr 19, 2022
    8. added 2 commits that reference this issue on Apr 19, 2022
    9. vstinner commented on Apr 21, 2022

      @vstinner
      MemberAuthor

      I proposed #32112 for that.

      Merged. On Python 3.9 and 3.10, I increased the timeout from 0.1 to 1.0 second (10x longer!):

      Let's say that it's enough for now.

    10. added a commit that references this issue on Jun 2, 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

      3.11only security fixestestsTests in the Lib/test dir

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions