blaze icon indicating copy to clipboard operation
blaze copied to clipboard

Graceful shutdowns for blaze-server

Open RaasAhsan opened this issue 4 years ago • 3 comments

I'm unhappy about the allocated call we're making for the Dispatcher, so we should probably gauge feasibility for getting graceful shutdowns.

RaasAhsan avatar Jan 08 '21 00:01 RaasAhsan

So, I think this is going to be nontrivial at best. The problem is that the Dispatcher can be called on ExecutionContexts which are not necessarily bounded to the lifetime of the Dispatcher, which means that it can "go out of scope" and get leaked. This happens at least with IdleTimeoutStage and NIOHead1Stage.

Maybe we can add some kind of latch that shutdown can synchronize against which is released after there is no more selector activity

RaasAhsan avatar Jan 08 '21 04:01 RaasAhsan

What do you think of https://github.com/http4s/http4s/pull/4160 ? (only for the tests part)

yanns avatar Jan 08 '21 17:01 yanns

@yanns I wasn't descriptive enough in the issue, I was actually referring to an allocated in BlazeServerBuilder, which is necessary for reasons listed above. The allocated in tests is less concerning but it's a good idea to do that too!

RaasAhsan avatar Jan 08 '21 20:01 RaasAhsan