You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Chia-Ping Tsai (Jira)" <ji...@apache.org> on 2026/10/04 15:54:00 UTC

[jira] [Commented] (KAFKA-20003) Buffer released too early in MemoryPool

    [ https://issues.apache.org/jira/browse/KAFKA-20003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18123165#comment-18123165 ] 

Chia-Ping Tsai commented on KAFKA-20003:
----------------------------------------

[~junrao] Should we move the logic to the generator instead of hardcoding the type list in ApiKeys? The generator could add a {{retainsBufferReference}} method to {{{}ApiMessageType{}}}, computed from the {{zeroCopy}} flag and {{records}} fields in the spec. That was actually cmccabe's original suggestion in #7342: https://github.com/apache/kafka/pull/7342#issuecomment-543979048

> Buffer released too early in MemoryPool
> ---------------------------------------
>
>                 Key: KAFKA-20003
>                 URL: https://issues.apache.org/jira/browse/KAFKA-20003
>             Project: Kafka
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 2.7.2, 2.8.2, 3.0.2, 3.1.2, 3.2.3, 3.3.0, 3.3.2, 3.4.1, 3.5.2, 3.6.2, 3.7.2, 3.8.1, 3.9.1, 4.0.1, 4.1.1
>            Reporter: Jun Rao
>            Assignee: Ken Huang
>            Priority: Minor
>
> https://issues.apache.org/jira/browse/KAFKA-10386 we introduced Type.COMPACT_RECORDS in SchemaGenerator. However, we forgot to add Type.COMPACT_RECORDS to ApiKeys.retainsBufferReference(). This can cause the buffer in MemoryPool to be released too early, leading the data corruption and potential other weird problems. 
>  
> This issue is already fixed via https://issues.apache.org/jira/browse/KAFKA-19634, but the changes are large. We probably should just fix the issue in ApiKeys.retainsBufferReference() in 4.2.0 and earlier versions.



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