From 9287edf7198970a7090b5243729a759dcdc0b95a Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Fri, 17 Nov 2023 11:51:00 -0500 Subject: [PATCH] fix(liveness): execute on worker pool (#1779) --- .../generic/HealthLivenessGetHandler.java | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/cryostat/net/web/http/generic/HealthLivenessGetHandler.java b/src/main/java/io/cryostat/net/web/http/generic/HealthLivenessGetHandler.java index 0f5097d573..7543a14f49 100644 --- a/src/main/java/io/cryostat/net/web/http/generic/HealthLivenessGetHandler.java +++ b/src/main/java/io/cryostat/net/web/http/generic/HealthLivenessGetHandler.java @@ -31,11 +31,6 @@ class HealthLivenessGetHandler implements RequestHandler { @Inject HealthLivenessGetHandler() {} - @Override - public void handle(RoutingContext ctx) { - ctx.response().setStatusCode(204).end(); - } - @Override public ApiVersion apiVersion() { return ApiVersion.GENERIC; @@ -55,4 +50,25 @@ public HttpMethod httpMethod() { public Set resourceActions() { return ResourceAction.NONE; } + + @Override + public boolean isAsync() { + // This response handler does not actually block, but we force it to execute on the worker + // pool so that the status check reports not only that the event loop dispatch thread is + // alive and responsive, but that the worker pool is also actively servicing requests. If we + // don't force this then this handler only checks if the event loop is alive, but the worker + // pool may be blocked or otherwise unresponsive and the application as a whole will not be + // usable. + return false; + } + + @Override + public boolean isOrdered() { + return true; + } + + @Override + public void handle(RoutingContext ctx) { + ctx.response().setStatusCode(204).end(); + } }