diff options
| author | Bar Harel <bzvi7919@gmail.com> | 2019-06-01 09:19:09 (GMT) |
|---|---|---|
| committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-06-01 09:19:09 (GMT) |
| commit | 6b282e18877ec84e927b381b4ce187eaf4ba3dd7 (patch) | |
| tree | 67b8d2c67bc175ee2fcbf2d5164e4dcba6291c50 /Lib/logging/handlers.py | |
| parent | 70c5f2ae6e6a07d44a8d3f3202ea01bf697e05db (diff) | |
| download | cpython-6b282e18877ec84e927b381b4ce187eaf4ba3dd7.zip cpython-6b282e18877ec84e927b381b4ce187eaf4ba3dd7.tar.gz cpython-6b282e18877ec84e927b381b4ce187eaf4ba3dd7.tar.bz2 | |
bpo-36813: Fix QueueListener to call task_done() upon termination. (GH-13113)
Fixed QueueListener in order to avoid random deadlocks.
Unable to add regression tests atm due to time constraints, will add it in a bit.
Regarding implementation, although it's nested, it does not cause performance issues whatsoever, and does not call task_done() in case of an exception (which is the right thing to do IMHO).
https://bugs.python.org/issue36813
Diffstat (limited to 'Lib/logging/handlers.py')
| -rw-r--r-- | Lib/logging/handlers.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 3727bf0..a913d27 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -1477,6 +1477,8 @@ class QueueListener(object): try: record = self.dequeue(True) if record is self._sentinel: + if has_task_done: + q.task_done() break self.handle(record) if has_task_done: |
