Wei-Chiu Chuang created RATIS-2729:
--------------------------------------

             Summary: RepliedCallIds.sent grows unbounded for read-only 
requests (e.g. WATCH)
                 Key: RATIS-2729
                 URL: https://issues.apache.org/jira/browse/RATIS-2729
             Project: Ratis
          Issue Type: Bug
          Components: client
            Reporter: Wei-Chiu Chuang


h2. Problem

Since RATIS-872, {{RaftClientImpl}} tracks replied call IDs for leader-bound 
requests. Every such 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 that perform many write + watch pairs (for 
example Apache Ozone {{XceiverClientRatis.watchForCommit()}} on the block write 
path) can accumulate millions of entries and hit {{OutOfMemoryError}}.

h2. Expected

{{RepliedCallIds#sent}} should stay bounded after read-only requests complete.

h2. Actual

{{sent}} grows by one per leader-bound read-only request (e.g. each watch), 
without bound.

h2. Suggested fix

On reply for read-only requests, remove the outgoing callId from {{sent}} 
(without updating the write {{replied}} queue used for RATIS-872 retry 
invalidation).

h2. Related

* RATIS-872
* Downstream impact reported internally on Ozone long replication / DistCp 
workloads



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to