LantaoJin edited a comment on issue #24964: [SPARK-28160][Core] Fix a bug that 
TransportClient.sendRpcSync may hang forever
URL: https://github.com/apache/spark/pull/24964#issuecomment-505700040
 
 
   @srowen , I only find one place in `ExternalShuffleClient.removeBlocks` 
which maybe has a similar problem (not OOM, just uncaught runtime exception):
   ```java
   public Future<Integer> removeBlocks(
         String host,
         int port,
         String execId,
         String[] blockIds) throws IOException, InterruptedException {
       checkInit();
       CompletableFuture<Integer> numRemovedBlocksFuture = new 
CompletableFuture<>();
       ByteBuffer removeBlocksMessage = new RemoveBlocks(appId, execId, 
blockIds).toByteBuffer();
       final TransportClient client = clientFactory.createClient(host, port);
       client.sendRpc(removeBlocksMessage, new RpcResponseCallback() {
         @Override
         public void onSuccess(ByteBuffer response) {
           BlockTransferMessage msgObj = 
BlockTransferMessage.Decoder.fromByteBuffer(response);
           
numRemovedBlocksFuture.complete(((BlocksRemoved)msgObj).numRemovedBlocks);
           client.close();
         }
   ```
   I prefer to change to below code since `fromByteBuffer` could throw 
`IllegalArgumentException`
   ```java
         @Override
         public void onSuccess(ByteBuffer response) {
           try {
             BlockTransferMessage msgObj = 
BlockTransferMessage.Decoder.fromByteBuffer(response);
             numRemovedBlocksFuture.complete(((BlocksRemoved) 
msgObj).numRemovedBlocks);
           } catch (Exception e) {
             logger.warn("Error trying to remove RDD blocks " + 
Arrays.toString(blockIds) +
               " via external shuffle service from executor: " + execId, e);
             numRemovedBlocksFuture.complete(0);
           } finally {
             client.close();
           }
         }
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to