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

   ### What changes were proposed in this pull request?
   
   `SendContainerRequestHandler` reserves space on the first message of a push 
and releases it in the `finally` block of both `onError` and `onCompleted`. 
Both blocks used the same guard (`volume != null && spaceToReserve > 0`) but 
neither cleared `spaceToReserve` after releasing. When a push fails on the last 
message, `onError` runs and releases the reservation; gRPC can then still 
deliver the sender's half close, so `onCompleted` runs for the same stream and 
releases the same reservation a second time. A later `onNext` that fails on the 
closed output would release again as well. Each such failure lowers the 
volume's committed bytes by one extra reservation (`2 x bytesUsed` of the 
pushed container, or `2 x ozone.scm.container.size` when the source sends no 
size), which can go below zero and is reported to SCM, after which 
`AvailableSpaceFilter` overstates the free space by that amount until the 
datanode restarts.
   
   This change routes both `finally` blocks through a single helper that 
releases the reservation and then sets `spaceToReserve` to 0, so any later 
callback of the same stream releases nothing.
   
   ### What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17023
   
   ## How was this patch tested?
   
   - `mvn -pl :hdds-container-service test 
-Dtest=TestSendContainerRequestHandler -DskipShade -DskipRecon`
   - `./hadoop-ozone/dev-support/checks/checkstyle.sh`


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