-
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
:caffeine:stress
throws OOM on v2.9.3
#694
Comments
Of course I'm not primarily interested in getting the
From reading some other discussions it does seem relevant that our loader involves a DB hit and therefore is relatively slow, so we should try increasing the initial capacity and/or using |
I think this is a side effect of working around JDK-8274349. It looks like writes are being processed but a pileups of tasks occurs as we try to compensate. I’m not sure what we can do as we try to avoid duplicate submissions but also have to protect against an executor that ignored our task. Under stress I think this leads to a buildup that wouldn’t occur naturally. |
To make sure I have what you're saying right -- it's expected that the And the |
I believe so, but I would have to investigate. There have been multiple bugs over the years where that thread pool has dropped or ignored tasks. For example JDK-8078490 was a multi-core race condition that bit us. Currently we schedule the work based on a state machine flag that avoids duplicates. However once reset by any thread it allows for a new task submission. Assuming that the work is fast, a few duplicates would be flushed quickly. As we've improved our fallback handling to compensate, maybe we should make this stricter again to only allow for a single in-flight task. If that task is never run then we are degraded to always rely on our fallback, but the system is already likely in a problematic state regardless as its own work might have been ignored. So stricter task scheduling logic is likely the right fix for the stress case to avoid flooding, while also having writers assist when the pool is broken. |
For your production use-case, please try AsyncCache. That should be unrelated to this issue and sounds more like the case we added a warning for recently. |
I haven't had a chance to look into this yet, but one reason is this could be refresh tasks. In that commit, the utility is defaulted to perform refresh operations (merely the last touch). Unfortunately in 2.x this may dispatch a new CompletableFuture per call to
|
Confirmed. This is due to the naive The drains from reads or writes do not show this problem in either version. That could be stricter as some duplicates are scheduled, but only up to 3-4 on my machine. I should clean up this utility to be nicer using Picoli and param flags, so it is clearer what operations it is running, etc. Thanks for the heads up on this, glad it is a non-issue. |
On master, the stress tester is now parameterized so it can be run using, ./gradlew :caffeine:stress --workload=read I'm sure the tool could be made better, but hopefully it won't be printing confusing details because of a hard coded default. |
On MacOS 11.6.4 (20G417)
The text was updated successfully, but these errors were encountered: