-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Occasionally Value is not evicted after expireAfterWrite
setting.
#212
Comments
The timetamps should be updated using Internally when a future is in-flight it does get the duration of |
Thanks your explain about writeTime.
and we only use
another is we have About thread, we try to use server's event-loop if possible. And usually we use even-loop thread to call
Not sure if possible, but I didn't found clue that eventLoop thread has blocking or in-complete from metrics(e.g. active or running thread has 0 value during 2 days. No blocking alert..). |
Do you think that you could write a failing test case? I don’t see the cause yet when trying to reproduce it. |
I can't reproduce in my local too. So still try to find the place where I can test. And curious about if |
Yes, it can except for the |
I see, I will try to reproduce... |
I wonder if this is due to refreshAfterWrite, which is pretty complicated. That seems the most likely culprit from walking through the code, but I don’t have a scenario yet. |
Let me try to remove refreshAfterWrite and test first. |
That’s too bad. I had a theory with refresh, but now I’m unsure. What JVM and OS are you running? I have had issues reported that we found were due to bugs in the platform itself. |
CentOS 6.8 and 1.8.0_92. Maybe I can test with new java version. |
I believe #203 is caused by a kernel bug. This causes lost wake ups, in that case a deadlock. Perhaps here it’s resulting in the future not to run its completion handlers. It’s a wild guess but your version is old enough. |
ah let me repost again. then when complete runs to here and get now first. then the expire maybe wrong(because now - far future won't be negative in this case), how do you think? I tried again with debug mode thread stop and step by step. |
My belief is that in that case, the worse that could happen is the entry is set with too old of a write time, causing it to expire immediately. Since we use the delta and the timestamp is read on the same thread, there shouldn't be any races or word tearing. A slow computation could result in the premature eviction, but not cause what you are seeing (a wraparound would take 288 years). We should probably move the read, but I don't think its causing this issue. |
Sorry I didn't get your point about get too old of a write time. and enter the if block? then hasExpired will be |
It will run concurrently, except for the portions under the Wouldn't |
AddTask got the lock and enter the block of checking in-flight future. Then replace's whenComplete got the System.nanoTime before AddTask. (I'm not sure the thread of AddTask & whenComplete must be same or not.) And about reset, I think it will return at https://github.com/ben-manes/caffeine/blob/master/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1937 |
oh! I see what you mean. Yes, that's a real possibility. Lets definitely fix that. |
Wow yes! hope this solve the problem. Thanks!! |
Now passes the TCK tests that were backwards incompatible with 1.0. The OSGI test is enabled now that jsr107 includes the bindings. Added a Jigsaw module names (fixes #211) for Java 9 modules. The work towards a clean Java 9 library (no javax.annotations, no Unsafe) is pending. This will released as version 3.0 when ready. Stricter expiration checks for #212. Previously a stale read of the current time was used where it was perceived as benign, to avoid excessive (expensive) calls to the system clock. This might have unintentionally resulted in an AsyncLoadingCache not expiring a future properly. Replaces the unnecessary NonReentrantLock with the JDK's rentrant one. In #203 a deadlock occurs, though it is not reproducable and most likely is due to a known (and scary) Linux kernel bug in older versions. The improvements to state management also means the lock is extremely cheap so any gains in the slimmer version are not detectable.
I think that I made the proper changes here. The latest build should be in the snapshot repository shortly. Can you use that and see if we fixed the problem? |
OK let me try and report here soon, maybe need 1 or 2 days |
Now passes the TCK tests that were backwards incompatible with 1.0. The OSGI test is enabled now that jsr107 includes the bindings. Added a Jigsaw module names (fixes #211) for Java 9 modules. The work towards a clean Java 9 library (no javax.annotations, no Unsafe) is pending. This will released as version 3.0 when ready. Stricter expiration checks for #212. Previously a stale read of the current time was used where it was perceived as benign, to avoid excessive (expensive) calls to the system clock. This might have unintentionally resulted in an AsyncLoadingCache not expiring a future properly. Replaces the unnecessary NonReentrantLock with the JDK's rentrant one. In #203 a deadlock occurs, though it is not reproducable and most likely is due to a known (and scary) Linux kernel bug in older versions. The improvements to state management also means the lock is extremely cheap so any gains in the slimmer version are not detectable.
Now passes the TCK tests that were backwards incompatible with 1.0. The OSGI test is enabled now that jsr107 includes the bindings. Added a Jigsaw module names (fixes #211) for Java 9 modules. The work towards a clean Java 9 library (no javax.annotations, no Unsafe) is pending. This will released as version 3.0 when ready. Stricter expiration checks for #212. Previously a stale read of the current time was used where it was perceived as benign, to avoid excessive (expensive) calls to the system clock. This might have unintentionally resulted in an AsyncLoadingCache not expiring a future properly. Replaces the unnecessary NonReentrantLock with the JDK's rentrant one. In #203 a deadlock occurs, though it is not reproducable and most likely is due to a known (and scary) Linux kernel bug in older versions. The improvements to state management also means the lock is extremely cheap so any gains in the slimmer version are not detectable.
Released |
Hi, I'm facing some weird problem recently. My caffeine version is 2.5.6.
My cache setting is like this
Sometimes 1 of my servers has stale data in caffeine cache. I have taken the heap dump, but I'm not sure if there is a way to let me find the clue(Maybe the problem is my remote calling code, but not found the problem yet).
stale's one (writeTime -9189666743569861076), data was updated 2 days before, and as above, I set 5 mins as expire time.

another data from cache in same instance(writeTime 33948135258891076)

And curious about the differences of writeTime too.
I trace the code and it looks like
-9189666743569861076 - Long.MAX_VALUE = 33705293284914733
. so it meansit doesn't reset on a completion callback
?(33948247-33705293)/60/60/24 = 2.x days.
so it's unfinished processing? But Node.value(CompletableFuture).result has data.
Is there any possibility that can make caffeine not to update/evict?
(I'm not sure, but if the write time keep -9189666743569861076(far future) make it never expired?)
The text was updated successfully, but these errors were encountered: