Message225208
Condition.wait() modifies self._waiters without holding the lock (when a wait with timeout times out without the condition being notified).
If this happens to occur in between construction of the _islice and _deque objects in Condition.notify():
def notify(self, n=1):
[...]
all_waiters = self._waiters
waiters_to_notify = _deque(_islice(all_waiters, n))
then the result is a RuntimeError exception:
File "/usr/lib/python3.4/threading.py", line 358, in notify_all
self.notify(len(self._waiters))
File "/usr/lib/python3.4/threading.py", line 341, in notify
waiters_to_notify = _deque(_islice(all_waiters, n))
RuntimeError: deque mutated during iteration
(I have a server which makes extensive use of conditions on which this happens about once a day.)
This patch fixes this bug by moving wait()'s modification of self._waiters to be inside the lock, as suggested by Antoine Pitrou here: http://bugs.python.org/issue17385#msg183875 |
|
Date |
User |
Action |
Args |
2014-08-11 23:47:11 | dougz | set | recipients:
+ dougz, pitrou |
2014-08-11 23:47:11 | dougz | set | messageid: <1407800831.15.0.236937632355.issue22185@psf.upfronthosting.co.za> |
2014-08-11 23:47:11 | dougz | link | issue22185 messages |
2014-08-11 23:47:10 | dougz | create | |
|