blaze icon indicating copy to clipboard operation
blaze copied to clipboard

Non-daemon threads currently preventing JVM termination

Open DGolubets opened this issue 3 years ago • 4 comments

Sometimes I see my apps not shutting down properly with this in the output:

Non-daemon threads currently preventing JVM termination: - 45: Thread[DestroyJavaVM,5,main]
 -  - 21: Thread[blaze-selector-0,5,main]

I can't easily reproduce this. But my question is: why do you make these threads non-daemon? Any particular reason?

Http4s version: 0.23.7

DGolubets avatar Feb 23 '22 16:02 DGolubets

That decision was probably made a long time ago, but I think the idea was that in-flight work could still be happening on these threads, so we wanted them to drain before shutting down. Unfortunately, blaze still doesn't have a graceful shutdown (#59), so keeping these threads around really doesn't help anything. And modern cats-effect thinking is to sequence everything into the main IO. I would not be opposed to changing this.

rossabaker avatar Mar 13 '22 05:03 rossabaker

Oops. I shouldn't have transferred this. Those threads are created in http4s, not in blaze.

rossabaker avatar Mar 13 '22 20:03 rossabaker

Transferring the issue broke your link in the previous comment, should be this 59: https://github.com/http4s/blaze/issues/59

dzanot avatar Jul 28 '22 17:07 dzanot

Actually I think this should be transferred back to the blaze repo 😅 all blaze dev happens there now.

armanbilge avatar Jul 28 '22 17:07 armanbilge