zentol commented on a change in pull request #6763: [FLINK-10415] Fail response 
future if connection closes in RestClient
URL: https://github.com/apache/flink/pull/6763#discussion_r220642450
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestClient.java
 ##########
 @@ -339,12 +338,26 @@ private static Request createRequest(String 
targetAddress, String targetUrl, Htt
                        .thenComposeAsync(
                                channel -> {
                                        ClientHandler handler = 
channel.pipeline().get(ClientHandler.class);
-                                       CompletableFuture<JsonResponse> future 
= handler.getJsonFuture();
+
+                                       CompletableFuture<JsonResponse> future;
+                                       boolean success = false;
+
                                        try {
-                                               httpRequest.writeTo(channel);
+                                               if (handler == null) {
+                                                       throw new 
IOException("Netty pipeline was not properly initialized.");
+                                               } else {
+                                                       
httpRequest.writeTo(channel);
+                                                       future = 
handler.getJsonFuture();
+                                                       success = true;
+                                               }
                                        } catch (IOException e) {
 
 Review comment:
   We should catch all exceptions here, then this issue wouldn't have occurred 
in the first place.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to