首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Linux上java应用程序的挂起

Linux上java应用程序的挂起
EN

Stack Overflow用户
提问于 2014-02-01 09:13:49
回答 1查看 2K关注 0票数 2

我在linux上运行我的应用程序,有时它被挂起。

请帮我弄明白为什么挂起来。请在下面找到呼叫堆栈。我认为jvm有问题。

代码语言:javascript
复制
user@ubuntu:~$ sudo /usr/lib/jvm/jdk1.7.0/bin/jstack -F 14429
Attaching to process ID 14429, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.25-b01
Deadlock Detection:

No deadlocks found.

Thread 14430: (state = BLOCKED)


Thread 14698: (state = IN_NATIVE)
 - java.io.FileInputStream.readBytes(byte[], int, int) @bci=0 (Interpreted frame)
 - java.io.FileInputStream.read(byte[], int, int) @bci=4, line=242 (Interpreted frame)
 - java.io.BufferedInputStream.fill() @bci=175, line=235 (Interpreted frame)
 - java.io.BufferedInputStream.read1(byte[], int, int) @bci=44, line=275 (Interpreted frame)
 - java.io.BufferedInputStream.read(byte[], int, int) @bci=49, line=334 (Interpreted frame)
 - java.io.FilterInputStream.read(byte[]) @bci=5, line=107 (Interpreted frame)
 - org.apache.commons.exec.StreamPumper.run() @bci=31, line=105 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=724 (Interpreted frame)


Thread 14697: (state = IN_NATIVE)
 - java.io.FileInputStream.readBytes(byte[], int, int) @bci=0 (Interpreted frame)
 - java.io.FileInputStream.read(byte[], int, int) @bci=4, line=242 (Interpreted frame)
 - java.io.BufferedInputStream.fill() @bci=175, line=235 (Interpreted frame)
 - java.io.BufferedInputStream.read1(byte[], int, int) @bci=44, line=275 (Interpreted frame)
 - java.io.BufferedInputStream.read(byte[], int, int) @bci=49, line=334 (Interpreted frame)
 - java.io.FilterInputStream.read(byte[]) @bci=5, line=107 (Interpreted frame)
 - org.apache.commons.exec.StreamPumper.run() @bci=31, line=105 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=724 (Interpreted frame)


Thread 14695: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.Object.wait() @bci=2, line=503 (Interpreted frame)
 - java.lang.UNIXProcess.waitFor() @bci=8, line=210 (Interpreted frame)
 - org.apache.commons.exec.DefaultExecutor.executeInternal(org.apache.commons.exec.CommandLine, java.util.Map, java.io.File, org.apache.commons.exec.ExecuteStreamHandler) @bci=106, line=347 (Interpreted frame)
 - org.apache.commons.exec.DefaultExecutor.access$200(org.apache.commons.exec.DefaultExecutor, org.apache.commons.exec.CommandLine, java.util.Map, java.io.File, org.apache.commons.exec.ExecuteStreamHandler) @bci=6, line=46 (Interpreted frame)
 - org.apache.commons.exec.DefaultExecutor$1.run() @bci=29, line=188 (Interpreted frame)


Thread 14621: (state = IN_NATIVE)
 - java.lang.UNIXProcess.waitForProcessExit(int) @bci=0 (Interpreted frame)
 - java.lang.UNIXProcess.access$200(java.lang.UNIXProcess, int) @bci=2, line=54 (Interpreted frame)
 - java.lang.UNIXProcess$3.run() @bci=11, line=174 (Interpreted frame)
 - java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) @bci=95, line=1145 (Interpreted frame)
 - java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=5, line=615 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=724 (Interpreted frame)


Thread 14496: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.Object.wait() @bci=2, line=503 (Interpreted frame)
 - java.util.TimerThread.mainLoop() @bci=28, line=526 (Interpreted frame)
 - java.util.TimerThread.run() @bci=1, line=505 (Interpreted frame)

Thread 14464: (state = BLOCKED)


Thread 14454: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.ref.ReferenceQueue.remove(long) @bci=44, line=135 (Interpreted frame)
 - java.lang.ref.ReferenceQueue.remove() @bci=2, line=151 (Interpreted frame)
 - java.lang.ref.Finalizer$FinalizerThread.run() @bci=16, line=189 (Interpreted frame)


Thread 14453: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.Object.wait() @bci=2, line=503 (Interpreted frame)
 - java.lang.ref.Reference$ReferenceHandler.run() @bci=46, line=133 (Interpreted frame)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-01 09:34:05

正如Peter所说,代码中的waitFor()调用似乎阻止了您。

也许你读的是STDOUTPUT过程,但不是STDERROR.看看这个古老的所以发布Capturing stdout when calling Runtime.exec

编辑:如果在代码中使用ProcessBuilder,请尝试

yourProcessBuilder.redirectErrorStream(true);

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21496214

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档