You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suggest to change switch it to Executors.newCachedThreadPool for it's JavaDocs explicitly says
Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available. These pools will typically improve the performance of programs that execute many short-lived asynchronous tasks. Calls to execute will reuse previously constructed threads if available. If no existing thread is available, a new thread will be created and added to the pool. Threads that have not been used for sixty seconds are terminated and removed from the cache. Thus, a pool that remains idle for long enough will not consume any resources.
The text was updated successfully, but these errors were encountered:
Steps to reproduce:
DependencyApplication
and thenConcurrencyDemoApplication
StuckApplicationTest
demo-service/application.yml
and setspring.threads.virtual.enabled: true
(by default it'sfalse
).ConcurrencyDemoApplication
StuckApplicationTest
againIf you now attach a profile (e.g. YourKit) you'll see there's potential deadlock with this stacktrace
This isn't a deadlock, but the application gets stuck at this method
Apparently, the reason is that
executorService
is single-thread executor and cannot serve more than 1 request simultaneously:I suggest to change switch it to
Executors.newCachedThreadPool
for it's JavaDocs explicitly saysThe text was updated successfully, but these errors were encountered: