Java batch which never gets finished due to getting blocked at java.lang.System.exit(int)
I have a Java batch which never gets finished. It invokes System.exit()
at the end of the code but according to thread dump, it's blocked at Shutdown.halt0()
for some reason and the batch never gets finished. What could be a cause for this?
It uses mysql-connector-java 5.1.38 and I also see a thread which is blocked at AbandonedConnectionCleanupThread.run()
but I'm not sure if it has something to do with this problem.
Java version:
$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
Thread dump:
Attaching to process ID 7229, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.144-b01
Deadlock Detection:
No deadlocks found.
Thread 7244: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove(long) @bci=59, line=143 (Compiled frame)
- com.mysql.jdbc.AbandonedConnectionCleanupThread.run() @bci=16, line=43 (Interpreted frame)
Locked ownable synchronizers:
- None
Thread 7238: (state = BLOCKED)
Locked ownable synchronizers:
- None
Thread 7237: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove(long) @bci=59, line=143 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove() @bci=2, line=164 (Interpreted frame)
- java.lang.ref.Finalizer$FinalizerThread.run() @bci=36, line=209 (Interpreted frame)
Locked ownable synchronizers:
- None
Thread 7236: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.Object.wait() @bci=2, line=502 (Interpreted frame)
- java.lang.ref.Reference.tryHandlePending(boolean) @bci=54, line=191 (Interpreted frame)
- java.lang.ref.Reference$ReferenceHandler.run() @bci=1, line=153 (Interpreted frame)
Locked ownable synchronizers:
- None
Thread 7230: (state = BLOCKED)
- java.lang.Shutdown.halt0(int) @bci=0 (Interpreted frame)
- java.lang.Shutdown.halt(int) @bci=7, line=139 (Interpreted frame)
- java.lang.Shutdown.exit(int) @bci=99, line=213 (Interpreted frame)
- java.lang.Runtime.exit(int) @bci=14, line=109 (Interpreted frame)
- java.lang.System.exit(int) @bci=4, line=971 (Interpreted frame)
- com.example.xxx.main(java.lang.String) @bci=140, line=71 (Interpreted frame)
Locked ownable synchronizers:
- None
java mysql
add a comment |
I have a Java batch which never gets finished. It invokes System.exit()
at the end of the code but according to thread dump, it's blocked at Shutdown.halt0()
for some reason and the batch never gets finished. What could be a cause for this?
It uses mysql-connector-java 5.1.38 and I also see a thread which is blocked at AbandonedConnectionCleanupThread.run()
but I'm not sure if it has something to do with this problem.
Java version:
$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
Thread dump:
Attaching to process ID 7229, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.144-b01
Deadlock Detection:
No deadlocks found.
Thread 7244: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove(long) @bci=59, line=143 (Compiled frame)
- com.mysql.jdbc.AbandonedConnectionCleanupThread.run() @bci=16, line=43 (Interpreted frame)
Locked ownable synchronizers:
- None
Thread 7238: (state = BLOCKED)
Locked ownable synchronizers:
- None
Thread 7237: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove(long) @bci=59, line=143 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove() @bci=2, line=164 (Interpreted frame)
- java.lang.ref.Finalizer$FinalizerThread.run() @bci=36, line=209 (Interpreted frame)
Locked ownable synchronizers:
- None
Thread 7236: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.Object.wait() @bci=2, line=502 (Interpreted frame)
- java.lang.ref.Reference.tryHandlePending(boolean) @bci=54, line=191 (Interpreted frame)
- java.lang.ref.Reference$ReferenceHandler.run() @bci=1, line=153 (Interpreted frame)
Locked ownable synchronizers:
- None
Thread 7230: (state = BLOCKED)
- java.lang.Shutdown.halt0(int) @bci=0 (Interpreted frame)
- java.lang.Shutdown.halt(int) @bci=7, line=139 (Interpreted frame)
- java.lang.Shutdown.exit(int) @bci=99, line=213 (Interpreted frame)
- java.lang.Runtime.exit(int) @bci=14, line=109 (Interpreted frame)
- java.lang.System.exit(int) @bci=4, line=971 (Interpreted frame)
- com.example.xxx.main(java.lang.String) @bci=140, line=71 (Interpreted frame)
Locked ownable synchronizers:
- None
java mysql
Java makes a distinction between a user thread and another type of thread known as a daemon thread. The difference between these two types of threads is that if the JVM determines that the only threads running in an application are daemon threads (i.e., there are no user threads), the Java runtime closes down the application. On the other hand, if at least one user thread is alive, the Java runtime won't terminate your application. Copied from stackoverflow.com/questions/9651842/…
– Scary Wombat
Nov 14 '18 at 6:28
@kohei-san, you work for an interesting company
– Scary Wombat
Nov 14 '18 at 6:28
@scary wombat thanks but is there something which indicates where I work for?
– Kohei Nozaki
Nov 14 '18 at 6:34
add a comment |
I have a Java batch which never gets finished. It invokes System.exit()
at the end of the code but according to thread dump, it's blocked at Shutdown.halt0()
for some reason and the batch never gets finished. What could be a cause for this?
It uses mysql-connector-java 5.1.38 and I also see a thread which is blocked at AbandonedConnectionCleanupThread.run()
but I'm not sure if it has something to do with this problem.
Java version:
$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
Thread dump:
Attaching to process ID 7229, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.144-b01
Deadlock Detection:
No deadlocks found.
Thread 7244: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove(long) @bci=59, line=143 (Compiled frame)
- com.mysql.jdbc.AbandonedConnectionCleanupThread.run() @bci=16, line=43 (Interpreted frame)
Locked ownable synchronizers:
- None
Thread 7238: (state = BLOCKED)
Locked ownable synchronizers:
- None
Thread 7237: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove(long) @bci=59, line=143 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove() @bci=2, line=164 (Interpreted frame)
- java.lang.ref.Finalizer$FinalizerThread.run() @bci=36, line=209 (Interpreted frame)
Locked ownable synchronizers:
- None
Thread 7236: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.Object.wait() @bci=2, line=502 (Interpreted frame)
- java.lang.ref.Reference.tryHandlePending(boolean) @bci=54, line=191 (Interpreted frame)
- java.lang.ref.Reference$ReferenceHandler.run() @bci=1, line=153 (Interpreted frame)
Locked ownable synchronizers:
- None
Thread 7230: (state = BLOCKED)
- java.lang.Shutdown.halt0(int) @bci=0 (Interpreted frame)
- java.lang.Shutdown.halt(int) @bci=7, line=139 (Interpreted frame)
- java.lang.Shutdown.exit(int) @bci=99, line=213 (Interpreted frame)
- java.lang.Runtime.exit(int) @bci=14, line=109 (Interpreted frame)
- java.lang.System.exit(int) @bci=4, line=971 (Interpreted frame)
- com.example.xxx.main(java.lang.String) @bci=140, line=71 (Interpreted frame)
Locked ownable synchronizers:
- None
java mysql
I have a Java batch which never gets finished. It invokes System.exit()
at the end of the code but according to thread dump, it's blocked at Shutdown.halt0()
for some reason and the batch never gets finished. What could be a cause for this?
It uses mysql-connector-java 5.1.38 and I also see a thread which is blocked at AbandonedConnectionCleanupThread.run()
but I'm not sure if it has something to do with this problem.
Java version:
$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
Thread dump:
Attaching to process ID 7229, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.144-b01
Deadlock Detection:
No deadlocks found.
Thread 7244: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove(long) @bci=59, line=143 (Compiled frame)
- com.mysql.jdbc.AbandonedConnectionCleanupThread.run() @bci=16, line=43 (Interpreted frame)
Locked ownable synchronizers:
- None
Thread 7238: (state = BLOCKED)
Locked ownable synchronizers:
- None
Thread 7237: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove(long) @bci=59, line=143 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove() @bci=2, line=164 (Interpreted frame)
- java.lang.ref.Finalizer$FinalizerThread.run() @bci=36, line=209 (Interpreted frame)
Locked ownable synchronizers:
- None
Thread 7236: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.Object.wait() @bci=2, line=502 (Interpreted frame)
- java.lang.ref.Reference.tryHandlePending(boolean) @bci=54, line=191 (Interpreted frame)
- java.lang.ref.Reference$ReferenceHandler.run() @bci=1, line=153 (Interpreted frame)
Locked ownable synchronizers:
- None
Thread 7230: (state = BLOCKED)
- java.lang.Shutdown.halt0(int) @bci=0 (Interpreted frame)
- java.lang.Shutdown.halt(int) @bci=7, line=139 (Interpreted frame)
- java.lang.Shutdown.exit(int) @bci=99, line=213 (Interpreted frame)
- java.lang.Runtime.exit(int) @bci=14, line=109 (Interpreted frame)
- java.lang.System.exit(int) @bci=4, line=971 (Interpreted frame)
- com.example.xxx.main(java.lang.String) @bci=140, line=71 (Interpreted frame)
Locked ownable synchronizers:
- None
java mysql
java mysql
asked Nov 14 '18 at 5:51
Kohei NozakiKohei Nozaki
534522
534522
Java makes a distinction between a user thread and another type of thread known as a daemon thread. The difference between these two types of threads is that if the JVM determines that the only threads running in an application are daemon threads (i.e., there are no user threads), the Java runtime closes down the application. On the other hand, if at least one user thread is alive, the Java runtime won't terminate your application. Copied from stackoverflow.com/questions/9651842/…
– Scary Wombat
Nov 14 '18 at 6:28
@kohei-san, you work for an interesting company
– Scary Wombat
Nov 14 '18 at 6:28
@scary wombat thanks but is there something which indicates where I work for?
– Kohei Nozaki
Nov 14 '18 at 6:34
add a comment |
Java makes a distinction between a user thread and another type of thread known as a daemon thread. The difference between these two types of threads is that if the JVM determines that the only threads running in an application are daemon threads (i.e., there are no user threads), the Java runtime closes down the application. On the other hand, if at least one user thread is alive, the Java runtime won't terminate your application. Copied from stackoverflow.com/questions/9651842/…
– Scary Wombat
Nov 14 '18 at 6:28
@kohei-san, you work for an interesting company
– Scary Wombat
Nov 14 '18 at 6:28
@scary wombat thanks but is there something which indicates where I work for?
– Kohei Nozaki
Nov 14 '18 at 6:34
Java makes a distinction between a user thread and another type of thread known as a daemon thread. The difference between these two types of threads is that if the JVM determines that the only threads running in an application are daemon threads (i.e., there are no user threads), the Java runtime closes down the application. On the other hand, if at least one user thread is alive, the Java runtime won't terminate your application. Copied from stackoverflow.com/questions/9651842/…
– Scary Wombat
Nov 14 '18 at 6:28
Java makes a distinction between a user thread and another type of thread known as a daemon thread. The difference between these two types of threads is that if the JVM determines that the only threads running in an application are daemon threads (i.e., there are no user threads), the Java runtime closes down the application. On the other hand, if at least one user thread is alive, the Java runtime won't terminate your application. Copied from stackoverflow.com/questions/9651842/…
– Scary Wombat
Nov 14 '18 at 6:28
@kohei-san, you work for an interesting company
– Scary Wombat
Nov 14 '18 at 6:28
@kohei-san, you work for an interesting company
– Scary Wombat
Nov 14 '18 at 6:28
@scary wombat thanks but is there something which indicates where I work for?
– Kohei Nozaki
Nov 14 '18 at 6:34
@scary wombat thanks but is there something which indicates where I work for?
– Kohei Nozaki
Nov 14 '18 at 6:34
add a comment |
1 Answer
1
active
oldest
votes
Adding an option DONT_FAKE_MONOTONIC=1
solved the problem.
A native library called "libfaketime" was used in my app and the option seems to be a workaround. Details: https://github.com/wolfcw/libfaketime/issues/109
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53293922%2fjava-batch-which-never-gets-finished-due-to-getting-blocked-at-java-lang-system%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Adding an option DONT_FAKE_MONOTONIC=1
solved the problem.
A native library called "libfaketime" was used in my app and the option seems to be a workaround. Details: https://github.com/wolfcw/libfaketime/issues/109
add a comment |
Adding an option DONT_FAKE_MONOTONIC=1
solved the problem.
A native library called "libfaketime" was used in my app and the option seems to be a workaround. Details: https://github.com/wolfcw/libfaketime/issues/109
add a comment |
Adding an option DONT_FAKE_MONOTONIC=1
solved the problem.
A native library called "libfaketime" was used in my app and the option seems to be a workaround. Details: https://github.com/wolfcw/libfaketime/issues/109
Adding an option DONT_FAKE_MONOTONIC=1
solved the problem.
A native library called "libfaketime" was used in my app and the option seems to be a workaround. Details: https://github.com/wolfcw/libfaketime/issues/109
answered Nov 14 '18 at 7:06
Kohei NozakiKohei Nozaki
534522
534522
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53293922%2fjava-batch-which-never-gets-finished-due-to-getting-blocked-at-java-lang-system%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Java makes a distinction between a user thread and another type of thread known as a daemon thread. The difference between these two types of threads is that if the JVM determines that the only threads running in an application are daemon threads (i.e., there are no user threads), the Java runtime closes down the application. On the other hand, if at least one user thread is alive, the Java runtime won't terminate your application. Copied from stackoverflow.com/questions/9651842/…
– Scary Wombat
Nov 14 '18 at 6:28
@kohei-san, you work for an interesting company
– Scary Wombat
Nov 14 '18 at 6:28
@scary wombat thanks but is there something which indicates where I work for?
– Kohei Nozaki
Nov 14 '18 at 6:34