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

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

Open
mdavis-xyz opened this issue Nov 12, 2024 · 1 comment
Open

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

mdavis-xyz opened this issue Nov 12, 2024 · 1 comment
Labels
stdlib Python modules in the Lib dir topic-multiprocessing type-bug An unexpected behavior, bug, or error

Comments

@mdavis-xyz
Copy link
Contributor

mdavis-xyz commented Nov 12, 2024

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

@mdavis-xyz mdavis-xyz added the type-bug An unexpected behavior, bug, or error label Nov 12, 2024
@ZeroIntensity ZeroIntensity added stdlib Python modules in the Lib dir topic-multiprocessing labels Nov 12, 2024
@Zheaoli
Copy link
Contributor

Zheaoli commented Nov 12, 2024

Confirmed on main branch.

I think we need to think about @vstinner #11139 . It's clean and useful I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir topic-multiprocessing type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants