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

Rui Fan resolved FLINK-40345.
-----------------------------
    Resolution: Fixed

Merged to master(2.4.0) via: 23d73809bf40ea6e06fa629f476bb55e58ecb059

> Buffer is recycled twice in FilteringHandler#recoverWithFiltering when 
> delivery fails
> -------------------------------------------------------------------------------------
>
>                 Key: FLINK-40345
>                 URL: https://issues.apache.org/jira/browse/FLINK-40345
>             Project: Flink
>          Issue Type: Sub-task
>    Affects Versions: 2.4.0
>            Reporter: Rui Fan
>            Assignee: Rui Fan
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 2.4.0
>
>
> In FilteringHandler#recoverWithFiltering, the catch block recycles buffers 
> starting
> at index i:
>  
>  
> {code:java}
> } catch (Throwable t) {
>     for (int j = i; j < filteredBuffers.size(); j++) {
>         filteredBuffers.get(j).recycleBuffer();
>     }
>     throw t;
> }{code}
>  
> But onRecoveredStateBuffer never leaves the buffer un-owned when it throws: it
> enqueues the buffer before the only statement that can throw
> (notifyChannelNonEmpty()). So the buffer at index i is recycled twice, 
> corrupting
> the reference count and the buffer pool. The loop should start at i + 1.
>  
> Introduced by FLINK-38930, master only. Reported by Roman in 
> [https://github.com/apache/flink/pull/28661#pullrequestreview-4832855136]
>  



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

Reply via email to