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

System.exit(0) not able to terminate the process when application running with Oracle UCP shutdownhook #373

Open
syedjinnah opened this issue Sep 30, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@syedjinnah
Copy link

Describe the bug

In our Java application, when we are trying to kill Java Process programmatically using System.exit(0), the process is not getting killed for long time even after 5 minutes or 10 minutes.
When we took thread dump of that Java process, after 5 minutes we could see, Java process not getting killed as thread is waiting in Shutdown hook where we see await call with timeout period as 10 seconds but still the thread is not coming out of await method and its running indefinitely.

We had this issue always when we run with Amazon Corretto 11.0.17
later we upgraded to 11.0.24.8.1

To Reproduce

Have java application,
use Oracle UCP for connection pooling.
issue shutdown by calling System.exit(0)

This issue is random behavior.

Expected behavior

When we issue shutdown using System.exit(0) the process and its PID should be clean exit but not happening.

Screenshots

Two threads during the thread dump taken after 115 seconds (appx 2 min)
"Thread-2" #17 prio=5 os_prio=0 cpu=1.64ms elapsed=115.74s tid=0x00007f8836a4e800 nid=0x1be022 waiting on condition [0x00007f879110c000]
java.lang.Thread.State: TIMED_WAITING (parking)
at jdk.internal.misc.Unsafe.park([email protected]/Native Method)
- parking to wait for <0x0000000761b80270> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos([email protected]/LockSupport.java:234)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await([email protected]/AbstractQueuedSynchronizer.java:2211)
at oracle.ucp.common.Core.waitForPendingGrowsToFinish(Core.java:2230)
at oracle.ucp.common.Core.access$2400(Core.java:79)
at oracle.ucp.common.Core$17.lambda$run$0(Core.java:2442)
at oracle.ucp.common.Core$17$$Lambda$795/0x0000000800b8f440.accept(Unknown Source)
at java.lang.Iterable.forEach([email protected]/Iterable.java:75)
at java.util.Collections$SynchronizedCollection.forEach([email protected]/Collections.java:2067)
- locked <0x0000000762409c58> (a java.util.Collections$SynchronizedSet)
at oracle.ucp.common.Core$17.run(Core.java:2441)

"main" #1 prio=5 os_prio=0 cpu=20511.55ms elapsed=185707.18s tid=0x00007f883402c000 nid=0x15b49e in Object.wait() [0x00007f883e017000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait([email protected]/Native Method)
- waiting on
at java.lang.Thread.join([email protected]/Thread.java:1300)
- waiting to re-lock in wait() <0x0000000761f7c840> (a oracle.ucp.common.Core$17)
at java.lang.Thread.join([email protected]/Thread.java:1375)
at java.lang.ApplicationShutdownHooks.runHooks([email protected]/ApplicationShutdownHooks.java:107)
at java.lang.ApplicationShutdownHooks$1.run([email protected]/ApplicationShutdownHooks.java:46)
at java.lang.Shutdown.runHooks([email protected]/Shutdown.java:130)
at java.lang.Shutdown.exit([email protected]/Shutdown.java:174)
- locked <0x000000076140fd18> (a java.lang.Class for java.lang.Shutdown)
at java.lang.Runtime.exit([email protected]/Runtime.java:116)
at java.lang.System.exit([email protected]/System.java:1769)
at com.authentic.Executive.main(Executive.java:808)

Platform information

OS: RHEL 8.8
Java Version: 11.0.24+8-LTS mixed mode
@syedjinnah syedjinnah added the bug Something isn't working label Sep 30, 2024
@syedjinnah
Copy link
Author

coreA.txt
Attaching thread dump for reference

@Autumn808
Copy link
Contributor

Thanks looking into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants