Fix memory leak caused by async tracking busy threads #289
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some
printf
debugging foo and reading the code helped to figure out that we were sporadically leakingThread
objects when processors died with an error.https://github.com/phstc/shoryuken/blob/e83a68bf9d460fdd368a38208032074cde085ca2/lib/shoryuken/processor.rb#L15 calls
real_thread
(which pairs Thread and Processor in manager's namespace) asynchronously and it sometimes executes beforeprocessor_died
is executed.I've set up logs for every addition/removal of
Manager.threads
elements and state after the action. Worker I've used failed randomly, approx 33% of times.Logs:
Fixing #88.
One +1 for simplifying the core and getting rid of asynchronous stuff where it's not needed. We should be more deliberate in defining thing as actors and establishing async communication between them.