Description
From the mailing list
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!
Attachments
Issue Links
- links to