[Supersize] Fix fragile job param binding in _BulkObjectFileAnalyzerSlave.Run().
_BulkObjectFileAnalyzerSlave.Run() is a message loop to process AnalyzePaths() and AnalyzeStringLiterals() executions across threads. However, jobs are created using lambdas that capture local variables by closure. This is fragile, since if the local variables are quickly updated, then the race condition would mutate queued jobs. This bug is manifested by calling nm.py main() directly on multiple .o files, using '--multiprocess' switch. This triggers the race condition, causing only last .o file to be processed In regular Supersize usage, there is likely sufficient delay so that the bug is unlikely to happen -- but if it does, then we'd have something that would be hard to debug! The solution is to handle messages in a separate function, to isolate contexts for local variables and closures. We chose this over functools.partial() for simplicity (no need to chase down individual cases). Change-Id: Ie985807a0f19cbb4d11e1236f805da2e0a25b26b Reviewed-on: https://chromium-review.googlesource.com/1135699 Commit-Queue: Samuel Huang <huangs@chromium.org> Reviewed-by:agrieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/master@{#574916}
Showing
Please register or sign in to comment