mateczagany commented on code in PR #27368:
URL: https://github.com/apache/flink/pull/27368#discussion_r2678513156


##########
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/AbstractRestHandler.java:
##########
@@ -85,14 +85,15 @@ protected CompletableFuture<Void> respondToRequest(
             response = FutureUtils.completedExceptionally(e);
         }
 
-        return response.thenAccept(
+        return response.thenAcceptAsync(
                 resp ->
                         HandlerUtils.sendResponse(
                                 ctx,
                                 httpRequest,
                                 resp,
                                 messageHeaders.getResponseStatusCode(),
-                                responseHeaders));
+                                responseHeaders),
+                ctx.executor());

Review Comment:
   The response should be written from Netty's event loop thread, which is 
enforced by Netty if called from another thread. 
   However, when enforced by Netty, for some reason the buffer won't be fully 
written if the server closes right after writing the buffer, triggering 
intermittent failures in 
`RestServerEndpointITCase#testShouldWaitForHandlersWhenClosing`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to