jojochuang opened a new pull request, #1624:
URL: https://github.com/apache/ratis/pull/1624

   ## Jira
   https://issues.apache.org/jira/browse/RATIS-2729
   
   ## Problem
   Since RATIS-872, every leader-bound `RaftClient` request calls 
`RepliedCallIds.get(callId)`, which inserts into the `sent` map. On reply, 
`RepliedCallIds.add()` runs only for non-read-only requests, which removes the 
entry from `sent`.
   
   Read-only RPC types (including `WATCH`) never call `add()`, so each 
completed watch leaves a permanent entry in `sent`. Long-lived `RaftClient` 
instances with high write + watch volume (for example Apache Ozone 
`XceiverClientRatis.watchForCommit()`) can accumulate millions of entries and 
OOM.
   
   ## Fix
   For read-only replies, remove the outgoing callId from `sent` via 
`removeSent()` without touching the write `replied` queue used for RATIS-872 
retry invalidation.
   
   ## Test plan
   - [x] `mvn install -DskipTests` in ratis repo
   - [x] Standalone repro (Ozone `dev-support/replied-call-ids-leak-repro/`): 
patched Ratis keeps `sent` size at 0 after 100 write+watch pairs; unpatched 
3.3.1 grows to 101 with `-DexpectLeak=true -Dratis.version=3.3.1`
   
   Generated-by: Cursor (Auto)
   
   Made with [Cursor](https://cursor.com)


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

Reply via email to