Skip to content

Thread limit exceeded replacing blocked worker #624

Answered by ben-manes
gumeg1 asked this question in Q&A
Discussion options

You must be logged in to vote

This indicates that you might be abusing the ForkJoinPool shared in the JVM. That has a limit set by ForkJoinPool.DEFAULT_COMMON_MAX_SPARES, where it may create new threads if the workers are blocked. This often happens when futures block on other futures and cause pool starvation. Since the pool is shared, it may be that other parts of your application are abusing it and the extra usage here causes an overflow.

You can specify a different pool in Caffeine.executor or CacheLoader.asyncReload which delegates to reload. Guava defaulted to running on the calling thread, which you can sort of simulate using Caffeine.executor(Runnable::run).

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@gumeg1
Comment options

@ben-manes
Comment options

Answer selected by ben-manes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants