blaze
blaze copied to clipboard
Graceful shutdowns for blaze-server
I'm unhappy about the allocated
call we're making for the Dispatcher
, so we should probably gauge feasibility for getting graceful shutdowns.
So, I think this is going to be nontrivial at best. The problem is that the Dispatcher
can be called on ExecutionContext
s 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
What do you think of https://github.com/http4s/http4s/pull/4160 ? (only for the tests part)
@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!