始终应用 Java 以“退出 143” Ubuntu 结尾
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4192364/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Always app Java end with "Exit 143" Ubuntu
提问by Fernando
I have an application in java, which is permanently pulled. Execute it as follows:
我有一个 Java 应用程序,它被永久拉取。执行如下:
nohup ant> log.txt &
The problem is that last indefinitely, the application quits and get a message "Exit 143".
问题是,无限期地,应用程序退出并收到一条消息“退出 143”。
回答by Adamski
Exit code 143 corresponds to SIGTERM
, which is the signal sent by default when you run kill <pid>
. Is it possible that another process or user is killing the application? Without more information it's difficult to suggest anything else.
退出码143对应的是SIGTERM
,是运行时默认发送的信号kill <pid>
。是否有可能是另一个进程或用户正在终止该应用程序?如果没有更多信息,就很难提出其他建议。
回答by Tarnay Kálmán
I ran into a similar issue while using nodejs, and it turned out that it was actually my app and my code that was killing it.
我在使用 nodejs 时遇到了类似的问题,结果发现实际上是我的应用程序和我的代码杀死了它。
I had code like this (ok, i don't have function names like that, but you get the point):
我有这样的代码(好吧,我没有那样的函数名,但你明白了):
kill_anything_that_is_still_running_from_previous_execution()
start_a_lot_of_stuff()
The problem was that kill_anything_that_is_still_running_from_previous_execution
was async and returned immediately and (due to bad "luck") the actual killing part always ended up happening only after start_a_lot_of_stuff
finished running, which is obviously not very great. #spawncamping
问题是它kill_anything_that_is_still_running_from_previous_execution
是异步的并立即返回,并且(由于“运气不好”)实际杀死部分总是在start_a_lot_of_stuff
完成运行后才发生,这显然不是很好。#spawncamping
Oh, and in JavaRuntime.getRuntime().exec("bash -c \"killall whatever\"")
is "async" if you don't wait for it to exit.
哦,如果您不等待它退出,那么在 Java 中Runtime.getRuntime().exec("bash -c \"killall whatever\"")
就是“异步”。