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

ASF GitHub Bot commented on KAFKA-6999:
---------------------------------------

dongjinleekr opened a new pull request #5351: KAFKA-6999: Document read-write 
lock usage of caching enabled stores
URL: https://github.com/apache/kafka/pull/5351
 
 
   Add description for the deadlock vulnerability of `ReadOnlyKeyValueStore`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Document read-write lock usage of caching enabled stores
> --------------------------------------------------------
>
>                 Key: KAFKA-6999
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6999
>             Project: Kafka
>          Issue Type: Improvement
>          Components: streams
>            Reporter: Matthias J. Sax
>            Priority: Minor
>
> From the mailing list
> {quote}Hello again fellow Kafkans,
>  
> Yesterday we observed a production deadlock take down one of our instances. 
> Upon digging, it's clear that our usage of Kafka is the proximate cause, but 
> the danger of our approach is not clear at all just from the Javadocs.
>  
> We have stream processors that read off an incoming KStream, possibly 
> cross-reference some data from an auxiliary table via 
> ReadOnlyKeyValueStore.get()
>  
> This is done via custom logic rather than a direct KTable join because which 
> index is consulted may change depending on the shape of incoming data.
>  
> The ROKVS docs state,
>  * A key value store that only supports read operations.
>  * Implementations should be thread-safe as concurrent reads and writes
>  * are expected.
>  
> They do **not** indicate that the CachingKVS layer uses a ReadWriteLock. If 
> you have one CachingKVS flush a record cause a read from another CKVS, you 
> are suddenly vulnerable to classic lock order reversals! Surprise!
>  
> A partial stack trace highlighting the problem, with many uninteresting 
> frames removed, is inline at the bottom of this mail.
>  
> You could probably rightly point to us allowing a "observer" pattern to 
> callback from within streams processing code is dangerous. We might move this 
> off to an auxiliary thread to alleviate this problem.
>  
> But it still remains -- when you go an read that ROKVS documentation, it sure 
> doesn't prepare you to this possibility!
>  {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to