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

Tsz-wo Sze resolved RATIS-2722.
-------------------------------
    Fix Version/s: 3.4.0
       Resolution: Fixed

The pull request is now merged.  Thanks, [~amaliujia]!

> Fix pending write capacity leak when leader rejects a client write in 
> preAppend
> -------------------------------------------------------------------------------
>
>                 Key: RATIS-2722
>                 URL: https://issues.apache.org/jira/browse/RATIS-2722
>             Project: Ratis
>          Issue Type: Bug
>          Components: Leader
>            Reporter: Rui Wang
>            Assignee: Rui Wang
>            Priority: Major
>             Fix For: 3.4.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> h2. Summary
> Fix pending write capacity leak when leader rejects a client write in 
> preAppend (or otherwise fails appendLog before the request is queued).
> h2. Problem
> Leaders limit concurrent client writes with pending request quotas (element 
> count and approximate total message bytes). For each write, the server calls 
> tryAcquire to reserve capacity, then addPendingRequest once the entry is 
> appended and queued.
> If the write fails after tryAcquire but before addPendingRequest, the 
> reservation was never released. Each failure permanently consumed quota even 
> though no request remained pending and the client already received an error.
> After enough failures (e.g. repeated state-machine rejection in 
> preAppendTransaction), the leader still appeared healthy but new writes 
> failed with ResourceUnavailableException while the pending queue was empty.
> h2. Root cause
> PendingRequests.tryAcquire(Message) charges limits and registers a Permit in 
> an internal pre-queue map. Capacity is normally released when the request is 
> removed from the pending map after the client is replied to.
> There was no release path when appendTransaction acquired a permit, then 
> state.appendLog(context) threw StateMachineException (including from 
> preAppendTransaction in the raft log). The code returned an error to the 
> client without calling releasePermit.



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

Reply via email to