Skip to content
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

LocalCache.LoadingValueReference.waitForValue need a timeout setting #3232

Closed
GodIsDevil opened this issue Aug 10, 2018 · 3 comments
Closed

Comments

@GodIsDevil
Copy link

I recently encountered the same production problems as this #2774. All threads are waiting for the load operation to complete, but the thread that performed the load operation could not be found. I don't want to discuss the reasons for this problem, I just want to solve this problem from the framework. I think the load operation should have a timeout, and the operation waiting for the load to complete should also have a timeout. This will ensure that my application will not die in extreme situations.I can provide a thread snapshot if you need it.

@ben-manes
Copy link
Contributor

I think a future-based cache might make more sense in this case. This would allow you to set a timeout either when producing the future (e.g. by the cache loader) or when consuming by copying the source. CompletableFuture added this type of chaining in JDK9. This is how you could resolve this issue in Caffeine, using its AsyncLoadingCache. I think that is a better place to put the responsibility rather than in the cache itself.

@cgdecker
Copy link
Member

cgdecker commented Oct 2, 2019

Sounds like this is generally a duplicate of #2774 since it's the same general issue?

That said, changes to cache other than straightforward bug fixes are unlikely and we're generally pointing people to Caffeine.

@cgdecker cgdecker closed this as completed Oct 2, 2019
@castortech
Copy link

Why if you are pointing people to Caffeine, can't I find any reference to Caffeine in the cache documentation section??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants