Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiprocessing: AttributeError: 'SimpleQueue' object has no attribute '_poll' #74487

Closed
DanielMoore mannequin opened this issue May 7, 2017 · 7 comments
Closed

multiprocessing: AttributeError: 'SimpleQueue' object has no attribute '_poll' #74487

DanielMoore mannequin opened this issue May 7, 2017 · 7 comments
Labels
3.7 (EOL) end of life OS-windows stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@DanielMoore
Copy link
Mannequin

DanielMoore mannequin commented May 7, 2017

BPO 30301
Nosy @pfmoore, @tjguk, @zware, @serhiy-storchaka, @zooba, @applio, @zhangyangyu
PRs
  • bpo-30301: Fix AttributeError when using SimpleQueue.empty() under *spawn* and *forkserver* start methods #1601
  • [3.5] bpo-30301: Fix AttributeError when using SimpleQueue.empty() #1627
  • [3.6] bpo-30301: Fix AttributeError when using SimpleQueue.empty() #1628
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-05-17.14:06:16.744>
    created_at = <Date 2017-05-07.19:01:50.828>
    labels = ['3.7', 'type-bug', 'library', 'OS-windows']
    title = "multiprocessing: AttributeError: 'SimpleQueue' object has no attribute '_poll'"
    updated_at = <Date 2017-05-17.14:06:16.743>
    user = 'https://bugs.python.org/DanielMoore'

    bugs.python.org fields:

    activity = <Date 2017-05-17.14:06:16.743>
    actor = 'xiang.zhang'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-05-17.14:06:16.744>
    closer = 'xiang.zhang'
    components = ['Library (Lib)', 'Windows']
    creation = <Date 2017-05-07.19:01:50.828>
    creator = 'Daniel Moore'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30301
    keywords = []
    message_count = 7.0
    messages = ['293209', '293753', '293774', '293838', '293850', '293853', '293854']
    nosy_count = 8.0
    nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'serhiy.storchaka', 'steve.dower', 'davin', 'xiang.zhang', 'Daniel Moore']
    pr_nums = ['1601', '1627', '1628']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30301'
    versions = ['Python 3.5', 'Python 3.6', 'Python 3.7']

    @DanielMoore
    Copy link
    Mannequin Author

    DanielMoore mannequin commented May 7, 2017

    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!

    @DanielMoore DanielMoore mannequin added type-crash A hard crash of the interpreter, possibly with a core dump stdlib Python modules in the Lib dir OS-windows labels May 7, 2017
    @vstinner vstinner changed the title “AttributeError: 'SimpleQueue' object has no attribute '_poll'” multiprocessing: AttributeError: 'SimpleQueue' object has no attribute '_poll' May 10, 2017
    @zhangyangyu
    Copy link
    Member

    Related commit is bdb1cf1. 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()

    @zhangyangyu zhangyangyu added 3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error and removed type-crash A hard crash of the interpreter, possibly with a core dump labels May 16, 2017
    @serhiy-storchaka
    Copy link
    Member

    LGTM. But can you convert the reproducer to a test?

    @zhangyangyu
    Copy link
    Member

    Thanks for your reply Serhiy. Test added. :-)

    @zhangyangyu
    Copy link
    Member

    New changeset 6f75bc0 by Xiang Zhang in branch 'master':
    bpo-30301: Fix AttributeError when using SimpleQueue.empty() (bpo-1601)
    6f75bc0

    @zhangyangyu
    Copy link
    Member

    New changeset 9081b36 by Xiang Zhang in branch '3.5':
    bpo-30301: Fix AttributeError when using SimpleQueue.empty() (bpo-1601) (bpo-1627)
    9081b36

    @zhangyangyu
    Copy link
    Member

    New changeset 43d4c03 by Xiang Zhang in branch '3.6':
    bpo-30301: Fix AttributeError when using SimpleQueue.empty() (bpo-1601) (bpo-1628)
    43d4c03

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life OS-windows stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants