Issue 30301: multiprocessing: AttributeError: 'SimpleQueue' object has no attribute '_poll' (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/74487

classification

Title: multiprocessing: AttributeError: 'SimpleQueue' object has no attribute '_poll'
Type: behavior Stage: resolved
Components: Library (Lib), Windows Versions: Python 3.7, Python 3.6, Python 3.5

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Daniel Moore, davin, paul.moore, serhiy.storchaka, steve.dower, tim.golden, xiang.zhang, zach.ware
Priority: normal Keywords:

Created on 2017-05-07 19:01 by Daniel Moore, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1601 merged xiang.zhang,2017-05-16 08:06
PR 1627 merged xiang.zhang,2017-05-17 13:11
PR 1628 merged xiang.zhang,2017-05-17 13:12
Messages (7)
msg293209 - (view) Author: Daniel Moore (Daniel Moore) Date: 2017-05-07 19:01
I originally posted this as a question on StackOverflow thinking I was doing something wrong: http://stackoverflow.com/questions/43834494/python-3-6-attributeerror-simplequeue-object-has-no-attribute-poll/43835368#43835368 But I think I found the solution and answered my own question. I'm pretty sure you need to set: self._poll = self._reader.poll in the __setstate__ method in the SimpleQueue class of queues.py from the multiprocessing library. Otherwise, I'd love to know an alternative solution. Thanks!
msg293753 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-16 07:51
Related commit is bdb1cf1ca56db25b33fb15dd91eef2cc32cd8973. A simple reproduce snippet: import multiprocessing as mp def foo(q): q.put('hello') assert not q.empty() if __name__ == '__main__': mp.set_start_method('spawn') q = mp.SimpleQueue() p = mp.Process(target=foo, args=(q,)) p.start() print(q.get()) p.join()
msg293774 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-05-16 16:44
LGTM. But can you convert the reproducer to a test?
msg293838 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-17 04:20
Thanks for your reply Serhiy. Test added. :-)
msg293850 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-17 13:04
New changeset 6f75bc003ab4d5294b0291289ae03f7a8d305f46 by Xiang Zhang in branch 'master': bpo-30301: Fix AttributeError when using SimpleQueue.empty() (#1601) https://github.com/python/cpython/commit/6f75bc003ab4d5294b0291289ae03f7a8d305f46
msg293853 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-17 14:02
New changeset 9081b36f330964faa4dee3af03228d2ca7c71835 by Xiang Zhang in branch '3.5': bpo-30301: Fix AttributeError when using SimpleQueue.empty() (#1601) (#1627) https://github.com/python/cpython/commit/9081b36f330964faa4dee3af03228d2ca7c71835
msg293854 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-17 14:03
New changeset 43d4c0329e2348540a3a16ac61b3032f04eefd34 by Xiang Zhang in branch '3.6': bpo-30301: Fix AttributeError when using SimpleQueue.empty() (#1601) (#1628) https://github.com/python/cpython/commit/43d4c0329e2348540a3a16ac61b3032f04eefd34
History
Date User Action Args
2022-04-11 14:58:46 admin set github: 74487
2017-05-17 14:06:16 xiang.zhang set status: open -> closedresolution: fixedstage: patch review -> resolved
2017-05-17 14:03:40 xiang.zhang set messages: +
2017-05-17 14:02:58 xiang.zhang set messages: +
2017-05-17 13:12:02 xiang.zhang set pull_requests: + <pull%5Frequest1719>
2017-05-17 13:11:42 xiang.zhang set pull_requests: + <pull%5Frequest1718>
2017-05-17 13:04:02 xiang.zhang set messages: +
2017-05-17 04:20:46 xiang.zhang set messages: +
2017-05-16 16:44:43 serhiy.storchaka set nosy: + serhiy.storchakamessages: +
2017-05-16 08:06:05 xiang.zhang set pull_requests: + <pull%5Frequest1692>
2017-05-16 07:51:13 xiang.zhang set versions: + Python 3.5, Python 3.7nosy: + xiang.zhangmessages: + type: crash -> behaviorstage: patch review
2017-05-10 23:52:33 vstinner set title: “AttributeError: 'SimpleQueue' object has no attribute '_poll'” -> multiprocessing: AttributeError: 'SimpleQueue' object has no attribute '_poll'
2017-05-09 10:02:10 xiang.zhang set nosy: + davin
2017-05-07 19:01:50 Daniel Moore create