-
Notifications
You must be signed in to change notification settings - Fork 529
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
Detect sbt thread cleaner and terminate workers #2705
Detect sbt thread cleaner and terminate workers #2705
Conversation
It's super annoying, but you have to register the new example app here for JS: cats-effect/tests/js/src/main/scala/catseffect/examplesplatform.scala Lines 31 to 44 in 63fe08c
|
cont = parked.get() | ||
// the only way we can be interrupted here is if it happened *externally* (probably sbt) | ||
if (isInterrupted()) | ||
done.set(true) |
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 clashes with the shutdown()
method on WorkStealingThreadPool
. I wonder if that method should be called instead, there's already a CAS which will make sure to call it once. Only setting done
won't clean up all resources.
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.
The problem with all this is that I don't know if the rest of the thread pools in the same IORuntime
are shut down. Technically, IORuntime#shutdown()
can also be called, since the WSTP
has a reference to its IORuntime
.
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 can swap it to call shutdown(). I'm actually not as worried about the other pools in the runtime because this is such an odd scenario. It'a kind of like being shut down from the inside out, and we can assume it's happening to everyone and not just us.
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.
Thanks for taking this on.
Also added a non-fatal test which doesn't reproduce the issue. I wasn't able to come up with a good way of rigorously testing this.
Fixes #2704