Detect sbt thread cleaner and terminate workers#2705
Detect sbt thread cleaner and terminate workers#2705djspiewak merged 4 commits intotypelevel:series/3.3.xfrom
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.
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.
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.
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.
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