#5194 defect new
log.msg can fail if someone removes an observer at the wrong time
|Reported by:||zseil||Owned by:||zseil|
branch-diff, diff-cov, branch-cov, buildbot
I saw this while working on Win32Reactor:
Traceback (most recent call last): File ".\twisted\internet\base.py", line 1181, in mainLoop self.doIteration(t) File ".\twisted\internet\win32eventreactor.py", line 164, in doWaitForMultipleEvents log.msg(channel='system', event='iteration', reactor=self) File ".\twisted\python\log.py", line 291, in msg observer = self.observers[i] exceptions.IndexError: list index out of range
In this case, the helper reactor was trying to log something in its own thread while the test in main reactor was trying to clean up an added log observer.
The attached test shows the same problem, but without using threads.