Skip to content

Multiprocessing queue doesn't make the program exit properly #132634

Closed as not planned
@albertino87

Description

@albertino87

Bug report

Bug description:

Hi, I'm observing a strange behaviour with python multiprocessing Queue object.

My environment:

OS: Windows 10
python: 3.13.1

but I observed the same with:

OS: Windows 10
python: 3.12.7

and:

OS: Windows 10
python: 3.10.14

I have this short script:

from multiprocessing import Queue

a = list(range(716))
queue: Queue = Queue()
for item in a:
    queue.put(item)
raise ValueError(f"my len: {len(a)}")

If I run it, everything is ok, it raises the error and exits:

Traceback (most recent call last):
  File "C:\Users\uXXXXXX\AppData\Roaming\JetBrains\PyCharmCE2024.3\scratches\scratch_1.py", line 7, in <module>
    raise ValueError(f"my len: {len(a)}")
ValueError: my len: 716

Process finished with exit code 1

but if i change the number from 716 to 717 or any other number above it, it raises the error but doesn't exits, the scripts hangs there. and when i forcefully stop the scripts it exits with code -1

Traceback (most recent call last):
  File "C:\Users\uXXXXXX\AppData\Roaming\JetBrains\PyCharmCE2024.3\scratches\scratch_1.py", line 7, in <module>
    raise ValueError(f"my len: {len(a)}")
ValueError: my len: 717

Process finished with exit code -1

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions