[issue34367] AsyncResult.get() only notifies one thread

Alexander Tsvetkov report at bugs.python.org
Thu Aug 9 10:17:49 EDT 2018


New submission from Alexander Tsvetkov <xflower at gmail.com>:

If more than one thread is waiting for the multiprocessing.pool.AsyncResult (aka ApplyResult) returned from apply_async, only one thread will be notified once the result arrives.

It happens because AsyncResult._set calls notify upon the result arrival, not notify_all.

threading.Event used in Python 3 uses notify_all.

Reproduction script is attached.
Expected outcome:
1
1
is printed to STDOUT.

Observed outcome:
The script hangs.

----------
components: Library (Lib)
files: async_result_demo.py
messages: 323323
nosy: AlexWithBeard
priority: normal
severity: normal
status: open
title: AsyncResult.get() only notifies one thread
versions: Python 2.7
Added file: https://bugs.python.org/file47736/async_result_demo.py

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


More information about the Python-bugs-list mailing list