Skip to content

[BUG] multiprocessing module hangs when starting workers #7146

@ReallyNiceGuy

Description

@ReallyNiceGuy

Describe the bug

When using multiprocessing Pool, the application hangs on get()
It will hang on close() also.

Code to reproduce the behaviour:

# example code
import multiprocessing as mp


def do_print(value):
    print(value)
    return f'Done {value}'


def main():
    pool = mp.Pool(mp.cpu_count())

    results = []

    results.append(pool.apply_async(do_print, ['uno']))

    for r in results:
        print(r.get())


if __name__ == '__main__':
    main()

Expected behaviour

Output:

uno
Done uno

OS

Linux Ubuntu 24.0.4 6.8.0-79-generic 79-Ubuntu SMP PREEMPT_DYNAMIC Tue Aug 12 14:42:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Python version

3.12.3

Cython version

3.1.3, 3.0.8

Additional context

compilation:

  cython -3 --embed test.pyx
  gcc -o test test.c -I /usr/include/python3.12 -Wl,-rpath,/usr/lib/x86_64-linux-gnu/libpython3.12.so /usr/lib/x86_64-linux-gnu/libpython3.12.so

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions