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

Alex Mironov commented on KAFKA-9156:
-------------------------------------

Hey [~lushilin],

Thanks for identifying the issue, I believe your reasoning and research is 
correct, as well as the proposed solution. I agree that AtomicReference might 
not be enough to protect this code due to "file_=" setter: there could be a 
situation when two threads will enter "if (timeIndex.isEmpty)" and "if 
(timeIndex.isDefined) else" blocks, thus leading to discrepancy between "_file" 
and "timeIndex.get.file" references.

We are running a patch for this in production for a few days now. If confirmed 
that it indeed fixes the issue, I'll create an MR.

> LazyTimeIndex & LazyOffsetIndex may cause niobufferoverflow in concurrent 
> state
> -------------------------------------------------------------------------------
>
>                 Key: KAFKA-9156
>                 URL: https://issues.apache.org/jira/browse/KAFKA-9156
>             Project: Kafka
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 2.3.0
>            Reporter: shilin Lu
>            Priority: Critical
>         Attachments: image-2019-11-07-17-42-13-852.png, 
> image-2019-11-07-17-44-05-357.png, image-2019-11-07-17-46-53-650.png
>
>
> !image-2019-11-07-17-42-13-852.png!
> this timeindex get function is not thread safe ,may cause create some 
> timeindex.
> !image-2019-11-07-17-44-05-357.png!
> When create timeindex not exactly one ,may cause mappedbytebuffer position to 
> end. Then write index entry to this mmap file will cause 
> java.nio.BufferOverflowException.
>  
> !image-2019-11-07-17-46-53-650.png!
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to