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

Jiangjie Qin commented on KAFKA-4232:
-------------------------------------

[~ijuma] Actually I am looking at the java memory model, and it looks my 
original assumption was not correct. As long as the operations are in a 
synchronized block, it follows the happens-before rule. So we don't need 
volatile annotation if `tryAppend` and `close` are both locking the same deque 
object.

There is a race condition when shutting down the sender thread due to the order 
we set the close flags in the accumulator and sender thread, but that seems 
orthogonal to the IllegalStateException we saw. I'll upload a separate patch 
for that. 

I will dig a bit deeper into the code and update the results here.

> IllegalStateException may be thrown from producer.send() when a batch is full.
> ------------------------------------------------------------------------------
>
>                 Key: KAFKA-4232
>                 URL: https://issues.apache.org/jira/browse/KAFKA-4232
>             Project: Kafka
>          Issue Type: Bug
>    Affects Versions: 0.10.0.0
>            Reporter: Jiangjie Qin
>            Assignee: Jiangjie Qin
>            Priority: Blocker
>             Fix For: 0.10.1.0
>
>
> MemoryRecords.writable should be volatile.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to