Reactor-netty: Support Graceful Shutdown

Created on 9 Mar 2020  路  4Comments  路  Source: reactor/reactor-netty

The current solution is

Stoping the ServerSocketChannel so that no more connections are accepted

DisposableServer#disposeNow()

Disposing the LoopResources with a delay in order to close the current active connections.

HttpResources.disposeLoopsAndConnectionsLater(quietPeriod, timeout)
    .delaySubscription(Duration.ofSeconds(20)) --> this delay is just an example
    .block();

or

LoopResources.disposeLater(quietPeriod, timeout)
    .delaySubscription(Duration.ofSeconds(20)) --> this delay is just an example
    .block();

We need a solution to be able to dispose the LoopResources as soon as there is no active connections instead of waiting a fixed time.

typenhancement

Most helpful comment

Hello @violetagg,

I am following up on your comment on this StackOverflow question. It seems like this issue tackles graceful shutdown of the reactor-netty server. However, the feature I am looking for is graceful handling of a request cancelled by a client (while the server is running and processing other requests.) What we are seeing is when a client cancels an in-flight request, the server simply stops processing. We would ideally like to capture the cancellation signal and perform some cleanup.

Could you let me know if it fixes the problem I am facing as well? If so, how could we capture the said cancellation signal?

Thank you!

All 4 comments

@rstoyanchev @wilkinsona PTAL #1034
What do you think about this approach?

Hello @violetagg,

I am following up on your comment on this StackOverflow question. It seems like this issue tackles graceful shutdown of the reactor-netty server. However, the feature I am looking for is graceful handling of a request cancelled by a client (while the server is running and processing other requests.) What we are seeing is when a client cancels an in-flight request, the server simply stops processing. We would ideally like to capture the cancellation signal and perform some cleanup.

Could you let me know if it fixes the problem I am facing as well? If so, how could we capture the said cancellation signal?

Thank you!

@deepak-auto let's use Gitter for this in order to not hijack this issue.

This looks good to me, @violetagg. Thank you.

Was this page helpful?
0 / 5 - 0 ratings