kylemeow commented on a change in pull request #11639: [FLINK-16626][runtime] Prevent REST handler from being closed more than once URL: https://github.com/apache/flink/pull/11639#discussion_r404517387
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/AbstractHandler.java ########## @@ -217,11 +223,17 @@ private void finalizeRequestProcessing(FileUploads uploadedFiles) { HttpResponseStatus.INTERNAL_SERVER_ERROR, responseHeaders); } + } @Override public final CompletableFuture<Void> closeAsync() { - return FutureUtils.composeAfterwards(closeHandlerAsync(), inFlightRequestTracker::awaitAsync); + if (isHandlerClosed.compareAndSet(false, true)) { + return FutureUtils.composeAfterwards(closeHandlerAsync(), inFlightRequestTracker::awaitAsync); + } else { + log.warn("Handler instance {} had already been closed, not allowed to close it again.", this); Review comment: Thanks for pointing out this, and I have changed this log message to the recommended way. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services