We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
The Queue._feed does not properly handle the size of the Queue on errors. This can lead to a situation where the Queue is considered as Full when it is empty. Here is a reproducing script:
Queue._feed
Queue
Full
import multiprocessing as mp q = mp.Queue(1) class FailPickle(): def __reduce__(self): raise ValueError() q.put(FailPickle()) print("Queue is full:", q.full()) q.put(0) print(f"Got result: {q.get()}")
This PR fixes this behavior.
https://bugs.python.org/issue33078
Sorry, something went wrong.
FIX properly handle queue size in on error
4b3e3fa
TST add non regression test
36087a5
DOC add NEWS entry
e5a127c
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! A few comments below.
Can you add a comment explaining why you need to adjust the semaphore's value?
Should you add a check for q.qsize() as well?
q.qsize()
Typo: "handling".
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.
Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.
I have made the requested changes; please review again
CLN typo and comments
747b3ab
Is this check correct? Depending on when the worker thread triggers, it might return 2, no?
I think it is correct because maxsize=1 so the second q.put should return only once the failure has been triggered.
maxsize=1
q.put
That's a good point, thank you.
e2f33ad
Thanks @pitrou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. 🐍🍒⛏🤖
3.7 branch.
bpo-33078 - Fix queue size on pickling error (pythonGH-6119)
0e919f9
(cherry picked from commit e2f33ad) Co-authored-by: Thomas Moreau <[email protected]>
bpo-33078 - Fix queue size on pickling error (GH-6119) (GH-6178)
bb5b529
7249ba0
pitrou pitrou approved these changes
rhettinger Awaiting requested review from rhettinger
Successfully merging this pull request may close these issues.