-
Notifications
You must be signed in to change notification settings - Fork 13
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
Insufficient cores leading to a deadlock or application hang #229
Comments
I can find 3 areas where tasks are submitted to the
I think what you've uncovered is an error in the design. The callback from the suffix stream calling Does my rambling make sense or should I go back to staring at the code some more? |
Hi Will, It seems ok to me after your changes. I ran a test with #236
IMHO, you can now create a new PR removing the method |
The application utilizes a
Semaphore
referred to asblockingSemaphore
to control a shared resource.AbstractShell.java
The
ScheduledThreadPoolExecutor
is configured with a limited number of cores.Previous code:
new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors()/2,new ThreadFactory() {
New code:
new ScheduledThreadPoolExecutor(getMinimumScheduleCorePoolSize(),new ThreadFactory() {
The
blockingSemaphore.acquire()
andblockingSemaphore.release()
are both created by theScheduledThreadPoolExecutor
mentioned above.A situation like the following will hang if
corePoolSize
of theScheduledThreadPoolExecutor
is equal to 2.If the number of cores is equals 2 (
new ScheduledThreadPoolExecutor(2,new ThreadFactory() {
) and you run the YAML above, two threads will be in theblockingSemaphore.acquire()
state. Because of that, there is no space for the third thread calls theblockingSemaphore.release()
and the application will hang forever.Increasing the number of cores (e.g., to 3) resolves the issue temporarily but introduces the potential for another scenario where three cores calls the
blockingSemaphore.acquire()
, leading to a hang. This approach merely postpones the issue without addressing its root cause.The text was updated successfully, but these errors were encountered: