4.x fix status from deadlock health check if invoking the MBean fails #9694
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.
Description
Resolves #9691
Release Note
Helidon's built-in deadlock health check now reports the state
ERROR
instead ofDOWN
if the invocation of the MBean method to retrieve deadlocked thread IDs throws an exception. (It used to reportDOWN
.)Reporting
ERROR
is more accurate, and in such cases Helidon returns the HTTP status 500 for the health response. This lets a deployment environment, such as Kubernetes, allow the pod to continue running. In such error cases Helidon (as it has for some time) logs aTRACE
-level message reporting the exception it encountered.The code for the deadlock health check used to report
DOWN
if it failed to invoke the threads MBean to retrieve the list of deadlocked thread IDs. (The method returns null if no deadlocks exist.)This PR changes that code to report
ERROR
instead ofDOWN
. By reportingDOWN
the previous code incorrectly implied that there was a deadlock and the server instance should be considered "unwell." In fact, in that case the health check code does not know whether there is or is not a deadlock because of the error invoking the MBean method and it should report that way.The PR also adds a test.
Documentation
No impact.