[New-bugs-announce] [issue35478] multiprocessing: ApplyResult.get() hangs if the pool is terminated

STINNER Victor report at bugs.python.org
Wed Dec 12 19:30:51 EST 2018


New submission from STINNER Victor <vstinner at redhat.com>:

The following code hangs:
---
import multiprocessing, time
pool = multiprocessing.Pool(1)
result = pool.apply_async(time.sleep, (1.0,))
pool.terminate()
result.get()
---

pool.terminate() terminates workers before time.sleep(1.0) completes, but the pool doesn't mark result as completed with an error.

Would it be possible to mark all pending tasks as failed? For example, "raise" a RuntimeError("pool terminated before task completed").

----------
components: Library (Lib)
messages: 331724
nosy: pablogsal, vstinner
priority: normal
severity: normal
status: open
title: multiprocessing: ApplyResult.get() hangs if the pool is terminated
versions: Python 3.8

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


More information about the New-bugs-announce mailing list