Skip to content

multiprocessing async .get() hangs if the pool is terminated #126743

@mdavis-xyz

Description

@mdavis-xyz

Bug report

Bug description:

MWE

Steps to reproduce:

import multiprocessing
from time import sleep

with multiprocessing.Pool() as p:
    result = p.apply_async(sleep, (1,))
result.get()

Expected behavior:

Either:

  • result is returned. (Pool().__exit__ waits for every async task to finish); or
  • some kind of exception is raised when .get() is called outside with Pool()

Comments

This is the same as #79659. That was marked as completed in 2021. However it seems the issue is still present.

CPython versions tested on:

3.12, 3.13, 3.14

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions