Log all the handlers for a stage before they start / stop.#18662
Merged
Conversation
This logs all the handlers at the start/stop lifecycle stage. This is useful to know the order ahead of time, especially when a service stops, some handlers don't execute.
jtuglu1
self-requested a review
October 18, 2025 01:20
jtuglu1
approved these changes
Oct 18, 2025
jtuglu1
left a comment
Contributor
There was a problem hiding this comment.
LGTM pending CI, minor comments.
| } | ||
| catch (Exception e) { | ||
| log.warn(e, "Lifecycle [%s] encountered exception while stopping %s", name, handler); | ||
| log.warn(e, "Lifecycle [%s] encountered exception while stopping [%s]", name, handler); |
Contributor
There was a problem hiding this comment.
nit: stopping handler [%s] to match other logs.
| @Override | ||
| public String toString() | ||
| { | ||
| return o.getClass().getSimpleName(); |
Contributor
There was a problem hiding this comment.
If there are duplicate handlers with same simpleName, do we care about differentiating them?
Contributor
Author
There was a problem hiding this comment.
It might be worth differentiating them if the handlers are ever invoked concurrently, in that case, we could include the object's hash code and update the AnnotationBasedHandler's start() and stop() methods too to include that info for individual handlers. Since they’re executed sequentially, it doesn’t matter much for now.
Contributor
Author
|
Thanks for the review @jtuglu1! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This logs all handlers during the start and stop lifecycle stages. It’s useful for understanding the execution order ahead of time, especially to identify which handlers didn’t run when a service stops. For example, some handlers like
SupervisorManager.stop()can take a while to stop, blocking other subsequent handlers from stopping if a certain timeout is exceeded.A sample of the start lifecycle logs:
A sample of the stop lifecycle logs:
This PR has: