Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait indefintely for http connections on shutdown by default #106511

Merged

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Mar 19, 2024

This commit changes the meaning of the http shutdown timeout when set to 0. Previously the shutdown would proceed immediately, killing active http connections. With this change 0 means no timeout is used, but active connections are still waited on, indefinitely. This new behavior is what was originally intended for the default value of the shutdown timeout setting.

This commit changes the meaning of the http shutdown timeout when set to
0. Previously the shutdown would proceed immediately, killing active
http connections. With this change 0 means no timeout is used, but
active connections are still waited on, indefinitely. This new behavior
is what was originally intended for the default value of the shutdown
timeout setting.
@rjernst rjernst added >bug :Core/Infra/Node Lifecycle Node startup, bootstrapping, and shutdown labels Mar 19, 2024
@rjernst rjernst requested review from a team and DaveCTurner March 19, 2024 21:14
@elasticsearchmachine elasticsearchmachine added v8.14.0 Team:Core/Infra Meta label for core/infra team labels Mar 19, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

Hi @rjernst, I've created a changelog YAML for you.

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I left a suggestion about logging during the infinite wait.

@@ -281,7 +281,8 @@ protected void doStop() {
logger.warn(format("timed out while waiting [%d]ms for clients to close connections", shutdownGracePeriodMillis));
}
} else {
logger.debug("closing all client connections immediately");
logger.debug("waiting indefinitely for clients to close connections");
FutureUtils.get(allClientsClosedListener);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it'd be slightly more operator-friendly to make this a loop of timed waits, logging and retrying on timeout, so that we can have some evidence in the logs that this is where we're waiting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree on Dave's point, when troubleshooting what's going here logs of periodic timeouts would help greatly

Copy link
Member Author

@rjernst rjernst Mar 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added logging. I put it at info level. There's a setting along with it, the poll time for how often we log, defaulting to 5 minutes.

@rjernst
Copy link
Member Author

rjernst commented Mar 21, 2024

@mosche @DaveCTurner Please have another look to see if the added logging is what you were thinking.

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

logger.debug("waiting indefinitely for clients to close connections");
}

// use a fixed time of 5 minutes for when to report how many connections remain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no longer a fixed time

@rjernst rjernst added the auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Mar 21, 2024
@elasticsearchmachine elasticsearchmachine merged commit 2b67444 into elastic:main Mar 21, 2024
14 checks passed
@rjernst rjernst deleted the shutdown/wait_for_http_connections branch March 21, 2024 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >bug :Core/Infra/Node Lifecycle Node startup, bootstrapping, and shutdown Team:Core/Infra Meta label for core/infra team v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants