amaliujia opened a new pull request, #11945:
URL: https://github.com/apache/ozone/pull/11945

   ## What changes were proposed in this pull request?
   
   Stop BlockDataStreamOutput#executePutBlock recursive calls when datas stream 
close fails.
   
   There is a wrongly call `executePutBlock(false, true);` when a 
`dataStreamCloseReply` indicate a failure. That `executePutBlock(false, true)` 
hits the same already closed `dataStreamCloseReply` and call 
`executePutBlock(false, true);` again, thus forms a recursive calls.
   
   The recursive calls eventually hit `Stackoverflow` issue but was swallowed 
by a CompletedFuture returned by `dataStreamCloseReply.whenComplete`:
   
   ```
   dataStreamCloseReply.whenComplete((reply, e) -> {
           if (e != null || reply == null || !reply.isSuccess()) {
             LOG.warn("Failed executePutBlockClose, reply=" + reply, e);
             try {
               executePutBlock(false, true);
             } catch (IOException ex) {
               throw new CompletionException(ex);
             }
           }
         });
    ```
   
   There is no handling after `dataStreamCloseReply.whenComplete(` thus  
`Stackoverflow` was gone. `Stackoverflow` could be discovered if we ever do:
   ```
   dataStreamCloseReply = dataStreamCloseReply.whenComplete((reply, e) -> { ... 
}
   ```
   
   AI helps run small tests locally and reports O(2000) calls before 
`Stackoverflow`.
   
   We could just call the `setIoException` to indicate `closed` to avoid the 
recursive calls.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17682
   
   ## How was this patch tested?
   
   Unit tests.
   


-- 
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]


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

Reply via email to