我遇到了logback的奇怪问题,那个FREEZE线程在尝试登录一个衍生的子java进程时。简要描述如下:
注意:
我推出了产生这种现象的简单代码:https://github.com/huymluu/logbackfreeze
编辑:添加主题转储
"process reaper@687" daemon prio=10 tid=0xc nid=NA runnable
java.lang.Thread.State: RUNNABLE
at java.lang.UNIXProcess.waitForProcessExit(UNIXProcess.java:-1)
at java.lang.UNIXProcess.lambda$initStreams$3(UNIXProcess.java:290)
at java.lang.UNIXProcess$$Lambda$7.687241927.run(Unknown Source:-1)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"main@1" prio=5 tid=0x1 nid=NA waiting
java.lang.Thread.State: WAITING
at java.lang.Object.wait(Object.java:-1)
at java.lang.Object.wait(Object.java:502)
at java.lang.UNIXProcess.waitFor(UNIXProcess.java:396)
at parent.ParentProcess.main(ParentProcess.java:20)
"Finalizer@689" daemon prio=8 tid=0x3 nid=NA waiting
java.lang.Thread.State: WAITING
at java.lang.Object.wait(Object.java:-1)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
"Reference Handler@690" daemon prio=10 tid=0x2 nid=NA waiting
java.lang.Thread.State: WAITING
at java.lang.Object.wait(Object.java:-1)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
"Signal Dispatcher@688" daemon prio=9 tid=0x4 nid=NA runnable
java.lang.Thread.State: RUNNABLE
答案 0 :(得分:1)
我认为logback在子进程的控制台输出方面存在问题。只是不知道它发生的详细原因。
尝试重定向子进程的输出将解决此问题。例如使用redirectOutput()
的{{1}}:
ProcessBuilder