File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,20 @@ def run(self) -> None:
147147
148148 def _handle_sigchld (self ) -> None :
149149 with self ._cvar :
150- self ._cvar .notify_all ()
150+ try :
151+ self ._cvar .notify_all ()
152+ except RuntimeError as ex :
153+ # In what looks like rare cases, notify_all(), seemingly when combined with
154+ # signal handling, raises `RuntimeError: release unlocked lock`.
155+ # There appears to be an unresolved Python bug about this:
156+ # https://bugs.python.org/issue34486
157+ # We catch the exception here and log it. It is hard to tell if that will not lead
158+ # to further issues. It would seem like it shouldn't: after all, all we're doing is
159+ # making sure we don't sleep too much, but, even if we do, the consequence is a
160+ # small delay in processing a completed job. However, since this exception seems
161+ # to be a logical impossibility when looking at the code in threading.Condition,
162+ # there is really no telling what else could go wrong.
163+ logger .warning ('Exception in Condition.notify_all()' , ex )
151164
152165 def _check_processes (self ) -> None :
153166 done : List [_ProcessEntry ] = []
You can’t perform that action at this time.
0 commit comments