[issue40907] cpython/lib/queue.py: put() does not acquire not_empty before notifying on it

2020-06-10 Thread r n


r n  added the comment:

Sorry, please ignore my previous comment, I can see that the issue is not in 
the queue, but probably be somewhere in my setup. 
I'll close this bug therefore. Thanks again for the clarification.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40907] cpython/lib/queue.py: put() does not acquire not_empty before notifying on it

2020-06-10 Thread r n


r n  added the comment:

Thanks for the response.
However, if you see, every condition object has their own queue of waiters in 
self._waiters, that get notified during notify(), which are different for 
not_empty and not_full.
I see a hang very very rarely, like 1/25 times, in my program, which keeps, 
reading from and writing to a queue from multiple threads.

--
nosy: +r n2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40907] cpython/lib/queue.py: put() does not acquire not_empty before notifying on it

2020-06-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Also note that threading.Condition.notify() would raise a RuntimeError if the 
underlying lock had not been acquired.

Have you observed any behavior to the contrary?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40907] cpython/lib/queue.py: put() does not acquire not_empty before notifying on it

2020-06-09 Thread Raymond Hettinger


New submission from Raymond Hettinger :

This code looks correct to me.  For condition variables, the requirement is 
that the underlying lock be held when notify() is called.  The not_full and 
not_empty condition variables share the same underlying lock, so it is 
sufficient that not_empty.notify() is called inside the body of "with 
self.not_full".

--
nosy: +tim.peters

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40907] cpython/lib/queue.py: put() does not acquire not_empty before notifying on it

2020-06-09 Thread r n


Change by r n :


--
versions: +Python 3.10, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40907] cpython/lib/queue.py: put() does not acquire not_empty before notifying on it

2020-06-08 Thread r n


Change by r n :


--
nosy: +rhettinger -r n2
title: cpython/queue.py: put() does not acquire not_empty before notifying on 
it -> cpython/lib/queue.py: put() does not acquire not_empty before notifying 
on it

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com