[ 
https://issues.apache.org/jira/browse/HDDS-17682?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rui Wang updated HDDS-17682:
----------------------------
    Description: 
Claude: In BlockDataStreamOutput#executePutBlock, a failed CLOSE reply re-calls 
executePutBlock on a stream that is already closed. This can recurse without 
limit.

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`:

 
{code:java}
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); }
   }
});
{code}
 

 

There is no handling after `dataStreamCloseReply.whenComplete(` thus 
`Stackoverflow` was gone. `Stackoverflow` could be discovered if we ever do:
{code:java}
dataStreamCloseReply = dataStreamCloseReply.whenComplete((reply, e) ->

{ ... }

{code}

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.

  was:
Claude: In BlockDataStreamOutput#executePutBlock, a failed CLOSE reply re-calls 
executePutBlock on a stream that is already closed. This can recurse without 
limit.



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.


> Stop BlockDataStreamOutput#executePutBlock recursive calls when datas stream 
> close fails
> ----------------------------------------------------------------------------------------
>
>                 Key: HDDS-17682
>                 URL: https://issues.apache.org/jira/browse/HDDS-17682
>             Project: Apache Ozone
>          Issue Type: Sub-task
>          Components: Ozone Client
>            Reporter: Tsz-wo Sze
>            Assignee: Rui Wang
>            Priority: Major
>              Labels: pull-request-available
>
> Claude: In BlockDataStreamOutput#executePutBlock, a failed CLOSE reply 
> re-calls executePutBlock on a stream that is already closed. This can recurse 
> without limit.
> 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`:
>  
> {code:java}
> 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); }
>    }
> });
> {code}
>  
>  
> There is no handling after `dataStreamCloseReply.whenComplete(` thus 
> `Stackoverflow` was gone. `Stackoverflow` could be discovered if we ever do:
> {code:java}
> dataStreamCloseReply = dataStreamCloseReply.whenComplete((reply, e) ->
> { ... }
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to