Issue 35478: multiprocessing: ApplyResult.get() hangs if the pool is terminated (original) (raw)

Issue35478

Created on 2018-12-13 00:30 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11136 closed vstinner,2018-12-13 00:53
PR 11139 closed vstinner,2018-12-13 02:28
Messages (3)
msg331724 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-12-13 00:30
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").
msg331793 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-12-14 10:12
Attached PR 11139 sets RuntimeError("Pool terminated") error in pending results if the pool is terminated.
msg336940 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-03-01 17:28
Pablo: since you worked on multiprocessing recently, did you see this bug? I'm not sure about my PR 11139... If someone else wants to work on a fix, ignore my PR ;-)
History
Date User Action Args
2022-04-11 14:59:09 admin set github: 79659
2021-09-21 22:26:36 vstinner set status: open -> closedresolution: out of datestage: patch review -> resolved
2021-09-21 22:26:17 vstinner unlink issue35479 dependencies
2019-03-01 17:28:19 vstinner set nosy: + pitrou, davinmessages: +
2018-12-14 11:56:25 vstinner link issue35479 dependencies
2018-12-14 10:12:35 vstinner set messages: +
2018-12-13 02:28:44 vstinner set pull_requests: + <pull%5Frequest10370>
2018-12-13 00:53:48 vstinner set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest10369>
2018-12-13 00:30:51 vstinner create