GitHub user dguy opened a pull request:

    https://github.com/apache/kafka/pull/2226

    KAFKA-4492: java.lang.IllegalStateException: Attempting to put a clean 
entry for key... into NamedCache

    The NamedCache wasn't correctly dealing with its re-entrant nature. This 
would result in the LRU becoming corrupted, and the above exception occurring 
during eviction. For example:
    Cache A: dirty key 1
    eviction runs on Cache A
    Node for key 1 gets marked as clean
    Entry for key 1 gets flushed downstream
    Downstream there is a processor that also refers to the table fronted by 
Cache A
    Downstream processor puts key 2 into Cache A
    This triggers an eviction of key 1 again ( it is still the oldest node as 
hasn't been removed from the LRU)
    As the Node for key 1 is clean flush doesn't run and it is immediately 
removed from the cache. 
    So now we have dirtyKey set with key =1, but the value doesn't exist in the 
cache.
    Downstream processor tries to put key = 1 into the cache, it fails as key 
=1 is in the dirtyKeySet.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dguy/kafka cache-bug

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/2226.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2226
    
----
commit 926ef4b1900c6870819948e12950f215ab3998ac
Author: Damian Guy <damian....@gmail.com>
Date:   2016-12-07T14:48:34Z

    fix cache bug

commit 6b6f3a57acacae1f0e4642ebc080ec9bc451e98c
Author: Damian Guy <damian....@gmail.com>
Date:   2016-12-07T17:12:47Z

    add comment about cache eviction

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to