[issue43805] multiprocessing.Queue hangs when process on other side dies

Marko report at bugs.python.org
Sun Apr 11 07:52:50 EDT 2021


New submission from Marko <ivanovic.marko at yandex.com>:

When child process dies unexpectedly Queue.get waits indefinitely.

Here is example:

import os
import signal
import multiprocessing

def child_func(qa, qb):
    input = qa.get()
    print('Child received: ', input)
    os.kill(os.getpid(), signal.SIGTERM)
    qb.put('B')
    exit(0)

qa = multiprocessing.Queue()
qb = multiprocessing.Queue()
process = multiprocessing.Process(target=child_func, args=(qa, qb))
process.start()

qa.put('A')
try:
    input = qb.get()
    print('Parent received: ', input)
except Exception as ex:
    print(ex)
process.join()
exit(0)

----------
components: Library (Lib)
messages: 390774
nosy: kormang
priority: normal
severity: normal
status: open
title: multiprocessing.Queue hangs when process on other side dies
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43805>
_______________________________________


More information about the Python-bugs-list mailing list