AsyncHttpClient/async-http-client

Shutdown is slow

halaei opened this issue · 0 comments

Shutdown process is slow, 3 seconds, even when the client is not used at all. I wonder what prevent immediate shutdown.

asyncHttpClient(
 config()
  .setConnectTimeout(5_000)
  .setRequestTimeout(20_000)
)

So I guess this is the shutdown logic:

// ChannelManager
  public void close() {
    if (allowReleaseEventLoopGroup) {
      eventLoopGroup
              .shutdownGracefully(config.getShutdownQuietPeriod(), config.getShutdownTimeout(), TimeUnit.MILLISECONDS)
              .addListener(future -> doClose());
    } else {
      doClose();
    }
  }

And I understand if I want to force faster shutdown I can pass a small value to setShutdownTimeout() builder function, but still I don't know why shutdown takes long when there was no interaction, even after close function was called.
Not sure if it is a bug or a good reason behind it.
Thanks :)