[
https://issues.apache.org/jira/browse/RATIS-2729?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tsz-wo Sze resolved RATIS-2729.
-------------------------------
Fix Version/s: 3.4.0
Resolution: Fixed
The pull request is now merged. Thanks [~weichiu]!
> 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
> Assignee: Wei-Chiu Chuang
> Priority: Major
> Labels: memory-leak
> Fix For: 3.4.0
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> 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)