-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix ForkJoinExecutor / Dispatcher Leak #3734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ForkJoinExecutor / Dispatcher Leak #3734
Conversation
…f ForkJoinDispatcher variants
threads.Count.Should().Be(4, "Expected 4 distinct threads in this example"); | ||
|
||
await Sys.Terminate(); | ||
AwaitAssert(() => threads.Values.All(x => x.IsAlive == false).Should().BeTrue("All threads should be stopped")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assertion currently fails - the Task
from Terminate()
completes without killing off any of the ForkJoinExecutor
threads.
Looks like the real fix to this bug is completing all outstanding work items inside the |
{ | ||
try | ||
{ | ||
task.Action.Run(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this was the major fix - the JVM has equivalent code too; need to make sure everything gets processed upon IScheduler
shutdown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a comment I'd like to get some clarity on to make sure I fully understand what is going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* close akkadotnet#2640 - fixed shutdown routine of HashedWheelTimerScheduler
Have a reproduction spec for #2640 in here, but not a fix yet.