threadCallQueue loop can grow list forever
|Reported by:||ghazel||Owned by:|
|Cc:||spiv, exarkun, glyph, jknight||Branch:|
callFromThread adds an event to self.threadCallQueue, then runUntilCurrent loops over that list calling events until the list is empty. If one of those events uses callFromThread, the list grows forever.
Now, I know there's no need to use callFromThread in this case since it's occurring in the main thread, but a very simple modification makes it work anyway.
foom preferred the method I implemented:
(alus): I think the loop should be written to iterate over a slice
(alus): or take a copy, or stop after a number
(alus): or something to prevent this
(foom): yes, it should get the count when it starts.
(foom): and then take that many and stop
(foom): and then delete those
(alus): ok, that modification fixes the leak
Also included in the patch is a method to re-call wakeUp when more events were added during iteration.
Change History (12)
Changed 8 years ago by ghazel
comment:1 Changed 8 years ago by ghazel
- Summary changed from callFromThread consumes memory to threadCallQueue loop can grow list forever
Changed 8 years ago by jknight
comment:7 Changed 8 years ago by jknight
- Owner ghazel deleted
- Priority changed from normal to highest