Java 包装器作为守护进程

发布于 2024-12-05 23:52:42 字数 5831 浏览 1 评论 0原文

我正在使用这个 YAJSW 在我的 Centos 5.5 机器上运行 Java Daemon。我认为它运行良好,但突然我注意到我遇到了这种错误,然后它就下降了。有什么帮助我必须做什么才能避免此类问题?我可以使用一些监控工具来监控并在出现问题时立即恢复吗?

以下只是错误列表的一部分。

NFO|3090/0|11-09-19 20:22:13|Controller State: LOGGED_ON -> PROCESS_KILLED
INFO|wrapper|11-09-19 20:22:13|restart process due to default exit code rule
INFO|wrapper|11-09-19 20:22:13|set state RUNNING->RESTART
INFO|wrapper|11-09-19 20:22:13|set state RESTART->RESTART_STOP
INFO|wrapper|11-09-19 20:22:13|stopping process with pid/timeout 3090 45000
INFO|3090/0|11-09-19 20:22:13|Controller State: PROCESS_KILLED -> WAITING_CLOSED
FINEST|3090/0|11-09-19 20:22:13|wrapper manager received stop command
INFO|3090/0|11-09-19 20:22:14|Controller State: WAITING_CLOSED -> USER_STOP
INFO|wrapper|11-09-19 20:22:14|stop config name null
INFO|wrapper|11-09-19 20:22:14|externalStop false
INFO|wrapper|11-09-19 20:22:14|exit code linux process 0
INFO|wrapper|11-09-19 20:22:14|killing 3090
INFO|3090/0|11-09-19 20:22:14|gobler execption OUTPUT 3090 null
INFO|3090/0|11-09-19 20:22:14|gobler execption ERROR 3090 null
INFO|3090/0|11-09-19 20:22:14|gobler terminated OUTPUT 3090
INFO|wrapper|11-09-19 20:22:14|process exit code: 0
INFO|3090/0|11-09-19 20:22:14|gobler terminated ERROR 3090
INFO|wrapper|11-09-19 20:22:14|set state RESTART_STOP->RESTART_WAIT
INFO|wrapper|11-09-19 20:22:19|set state RESTART_WAIT->RESTART_START
INFO|wrapper|11-09-19 20:22:19|starting Process
INFO|3090/0|11-09-19 20:22:19|Controller State: USER_STOP -> UNKNOWN
INFO|wrapper|11-09-19 20:22:19|Controller State: UNKNOWN -> WAITING
INFO|wrapper|11-09-19 20:22:20|working dir /usr/local
INFO|wrapper|11-09-19 20:22:20|error initializing script 
INFO|wrapper|11-09-19 20:22:20|exec:/usr/java/jdk1.6.0_18/bin/java -classpath /usr/local/yajsw-beta-10.2/./wrapperApp.jar:/usr/local -Xrs -Dwrapper.service=true -Dwrapper.console.visible=false -Dwrapper.visible=false -Dwrapper.pidfile=/var/run/wrapper.commServer.pid -Dwrapper.config=/usr/local/yajsw-beta-10.2/conf/wrapper.conf -Dwrapper.port=15003 -Dwrapper.key=-6288918147195966892 -Dwrapper.teeName=-6288918147195966892$1316434940036 -Dwrapper.tmpPath=/tmp org.rzo.yajsw.app.WrapperJVMMain 
INFO|wrapper|11-09-19 20:22:20|started process 8988
INFO|wrapper|11-09-19 20:22:20|started process with pid 8988
INFO|wrapper|11-09-19 20:22:20|set state RESTART_START->RUNNING
INFO|wrapper|11-09-19 20:22:34|Controller State: WAITING -> STARTUP_TIMEOUT
INFO|wrapper|11-09-19 20:22:34|restart process due to default exit code rule
INFO|wrapper|11-09-19 20:22:34|set state RUNNING->RESTART
INFO|wrapper|11-09-19 20:22:34|set state RESTART->RESTART_STOP
INFO|wrapper|11-09-19 20:22:34|stopping process with pid/timeout 8988 45000
INFO|wrapper|11-09-19 20:22:34|Controller State: STARTUP_TIMEOUT -> USER_STOP
INFO|wrapper|11-09-19 20:22:34|stop config name null
INFO|wrapper|11-09-19 20:22:34|externalStop false
INFO|wrapper|11-09-19 20:23:19|process did not stop after 45000 sec. -> hard kill
INFO|wrapper|11-09-19 20:23:19|killing 8988
INFO|wrapper|11-09-19 20:23:19|send kill sig
INFO|wrapper|11-09-19 20:23:19|exit code linux process 9
INFO|wrapper|11-09-19 20:23:19|Controller State: USER_STOP -> PROCESS_KILLED
INFO|8988/1|11-09-19 20:23:20|gobler execption OUTPUT 8988 null
INFO|8988/1|11-09-19 20:23:20|gobler execption ERROR 8988 null
INFO|wrapper|11-09-19 20:23:20|process exit code: 999
INFO|8988/1|11-09-19 20:23:20|gobler terminated OUTPUT 8988
INFO|8988/1|11-09-19 20:23:20|gobler terminated ERROR 8988
INFO|wrapper|11-09-19 20:23:20|set state RESTART_STOP->RESTART_WAIT
INFO|wrapper|11-09-19 20:23:25|set state RESTART_WAIT->RESTART_START
INFO|wrapper|11-09-19 20:23:25|starting Process
INFO|wrapper|11-09-19 20:23:25|Controller State: PROCESS_KILLED -> UNKNOWN
INFO|wrapper|11-09-19 20:23:25|Controller State: UNKNOWN -> WAITING
INFO|wrapper|11-09-19 20:23:25|working dir /usr/local
INFO|wrapper|11-09-19 20:23:25|error initializing script 
INFO|wrapper|11-09-19 20:23:25|exec:/usr/java/jdk1.6.0_18/bin/java -classpath /usr/local/yajsw-beta-10.2/./wrapperApp.jar:/usr/local -Xrs -Dwrapper.service=true -Dwrapper.console.visible=false -Dwrapper.visible=false -Dwrapper.pidfile=/var/run/wrapper.commServer.pid -Dwrapper.config=/usr/local/yajsw-beta-10.2/conf/wrapper.conf -Dwrapper.port=15003 -Dwrapper.key=-6288918147195966892 -Dwrapper.teeName=-6288918147195966892$1316435005686 -Dwrapper.tmpPath=/tmp org.rzo.yajsw.app.WrapperJVMMain 
INFO|wrapper|11-09-19 20:23:26|started process 8989
INFO|wrapper|11-09-19 20:23:26|started process with pid 8989
INFO|wrapper|11-09-19 20:23:26|set state RESTART_START->RUNNING
INFO|wrapper|11-09-19 20:23:40|Controller State: WAITING -> STARTUP_TIMEOUT
INFO|wrapper|11-09-19 20:23:40|restart process due to default exit code rule
INFO|wrapper|11-09-19 20:23:40|set state RUNNING->RESTART
INFO|wrapper|11-09-19 20:23:40|set state RESTART->RESTART_STOP
INFO|wrapper|11-09-19 20:23:40|stopping process with pid/timeout 8989 45000
INFO|wrapper|11-09-19 20:23:40|Controller State: STARTUP_TIMEOUT -> USER_STOP
INFO|wrapper|11-09-19 20:23:40|stop config name null
INFO|wrapper|11-09-19 20:23:40|externalStop false
INFO|wrapper|11-09-19 20:24:25|process did not stop after 45000 sec. -> hard kill
INFO|wrapper|11-09-19 20:24:25|killing 8989
INFO|wrapper|11-09-19 20:24:25|send kill sig
INFO|wrapper|11-09-19 20:24:25|exit code linux process 9
INFO|wrapper|11-09-19 20:24:25|Controller State: USER_STOP -> PROCESS_KILLED
INFO|8989/2|11-09-19 20:24:26|gobler execption OUTPUT 8989 null
INFO|8989/2|11-09-19 20:24:26|gobler execption ERROR 8989 null
INFO|wrapper|11-09-19 20:24:26|process exit code: 999
INFO|8989/2|11-09-19 20:24:26|gobler terminated OUTPUT 8989
INFO|8989/2|11-09-19 20:24:26|gobler terminated ERROR 8989

I am using this YAJSW to run Java Daemon on my Centos 5.5 machines. The think it runs well but out of suddent I notice I get this sort of error and then it just goes down. Any help what must I do to avoid this sort of problem? Can I use some monitoring tool to monitor and recover it as soon it falls into problem?

Below is just part of the error list.

NFO|3090/0|11-09-19 20:22:13|Controller State: LOGGED_ON -> PROCESS_KILLED
INFO|wrapper|11-09-19 20:22:13|restart process due to default exit code rule
INFO|wrapper|11-09-19 20:22:13|set state RUNNING->RESTART
INFO|wrapper|11-09-19 20:22:13|set state RESTART->RESTART_STOP
INFO|wrapper|11-09-19 20:22:13|stopping process with pid/timeout 3090 45000
INFO|3090/0|11-09-19 20:22:13|Controller State: PROCESS_KILLED -> WAITING_CLOSED
FINEST|3090/0|11-09-19 20:22:13|wrapper manager received stop command
INFO|3090/0|11-09-19 20:22:14|Controller State: WAITING_CLOSED -> USER_STOP
INFO|wrapper|11-09-19 20:22:14|stop config name null
INFO|wrapper|11-09-19 20:22:14|externalStop false
INFO|wrapper|11-09-19 20:22:14|exit code linux process 0
INFO|wrapper|11-09-19 20:22:14|killing 3090
INFO|3090/0|11-09-19 20:22:14|gobler execption OUTPUT 3090 null
INFO|3090/0|11-09-19 20:22:14|gobler execption ERROR 3090 null
INFO|3090/0|11-09-19 20:22:14|gobler terminated OUTPUT 3090
INFO|wrapper|11-09-19 20:22:14|process exit code: 0
INFO|3090/0|11-09-19 20:22:14|gobler terminated ERROR 3090
INFO|wrapper|11-09-19 20:22:14|set state RESTART_STOP->RESTART_WAIT
INFO|wrapper|11-09-19 20:22:19|set state RESTART_WAIT->RESTART_START
INFO|wrapper|11-09-19 20:22:19|starting Process
INFO|3090/0|11-09-19 20:22:19|Controller State: USER_STOP -> UNKNOWN
INFO|wrapper|11-09-19 20:22:19|Controller State: UNKNOWN -> WAITING
INFO|wrapper|11-09-19 20:22:20|working dir /usr/local
INFO|wrapper|11-09-19 20:22:20|error initializing script 
INFO|wrapper|11-09-19 20:22:20|exec:/usr/java/jdk1.6.0_18/bin/java -classpath /usr/local/yajsw-beta-10.2/./wrapperApp.jar:/usr/local -Xrs -Dwrapper.service=true -Dwrapper.console.visible=false -Dwrapper.visible=false -Dwrapper.pidfile=/var/run/wrapper.commServer.pid -Dwrapper.config=/usr/local/yajsw-beta-10.2/conf/wrapper.conf -Dwrapper.port=15003 -Dwrapper.key=-6288918147195966892 -Dwrapper.teeName=-6288918147195966892$1316434940036 -Dwrapper.tmpPath=/tmp org.rzo.yajsw.app.WrapperJVMMain 
INFO|wrapper|11-09-19 20:22:20|started process 8988
INFO|wrapper|11-09-19 20:22:20|started process with pid 8988
INFO|wrapper|11-09-19 20:22:20|set state RESTART_START->RUNNING
INFO|wrapper|11-09-19 20:22:34|Controller State: WAITING -> STARTUP_TIMEOUT
INFO|wrapper|11-09-19 20:22:34|restart process due to default exit code rule
INFO|wrapper|11-09-19 20:22:34|set state RUNNING->RESTART
INFO|wrapper|11-09-19 20:22:34|set state RESTART->RESTART_STOP
INFO|wrapper|11-09-19 20:22:34|stopping process with pid/timeout 8988 45000
INFO|wrapper|11-09-19 20:22:34|Controller State: STARTUP_TIMEOUT -> USER_STOP
INFO|wrapper|11-09-19 20:22:34|stop config name null
INFO|wrapper|11-09-19 20:22:34|externalStop false
INFO|wrapper|11-09-19 20:23:19|process did not stop after 45000 sec. -> hard kill
INFO|wrapper|11-09-19 20:23:19|killing 8988
INFO|wrapper|11-09-19 20:23:19|send kill sig
INFO|wrapper|11-09-19 20:23:19|exit code linux process 9
INFO|wrapper|11-09-19 20:23:19|Controller State: USER_STOP -> PROCESS_KILLED
INFO|8988/1|11-09-19 20:23:20|gobler execption OUTPUT 8988 null
INFO|8988/1|11-09-19 20:23:20|gobler execption ERROR 8988 null
INFO|wrapper|11-09-19 20:23:20|process exit code: 999
INFO|8988/1|11-09-19 20:23:20|gobler terminated OUTPUT 8988
INFO|8988/1|11-09-19 20:23:20|gobler terminated ERROR 8988
INFO|wrapper|11-09-19 20:23:20|set state RESTART_STOP->RESTART_WAIT
INFO|wrapper|11-09-19 20:23:25|set state RESTART_WAIT->RESTART_START
INFO|wrapper|11-09-19 20:23:25|starting Process
INFO|wrapper|11-09-19 20:23:25|Controller State: PROCESS_KILLED -> UNKNOWN
INFO|wrapper|11-09-19 20:23:25|Controller State: UNKNOWN -> WAITING
INFO|wrapper|11-09-19 20:23:25|working dir /usr/local
INFO|wrapper|11-09-19 20:23:25|error initializing script 
INFO|wrapper|11-09-19 20:23:25|exec:/usr/java/jdk1.6.0_18/bin/java -classpath /usr/local/yajsw-beta-10.2/./wrapperApp.jar:/usr/local -Xrs -Dwrapper.service=true -Dwrapper.console.visible=false -Dwrapper.visible=false -Dwrapper.pidfile=/var/run/wrapper.commServer.pid -Dwrapper.config=/usr/local/yajsw-beta-10.2/conf/wrapper.conf -Dwrapper.port=15003 -Dwrapper.key=-6288918147195966892 -Dwrapper.teeName=-6288918147195966892$1316435005686 -Dwrapper.tmpPath=/tmp org.rzo.yajsw.app.WrapperJVMMain 
INFO|wrapper|11-09-19 20:23:26|started process 8989
INFO|wrapper|11-09-19 20:23:26|started process with pid 8989
INFO|wrapper|11-09-19 20:23:26|set state RESTART_START->RUNNING
INFO|wrapper|11-09-19 20:23:40|Controller State: WAITING -> STARTUP_TIMEOUT
INFO|wrapper|11-09-19 20:23:40|restart process due to default exit code rule
INFO|wrapper|11-09-19 20:23:40|set state RUNNING->RESTART
INFO|wrapper|11-09-19 20:23:40|set state RESTART->RESTART_STOP
INFO|wrapper|11-09-19 20:23:40|stopping process with pid/timeout 8989 45000
INFO|wrapper|11-09-19 20:23:40|Controller State: STARTUP_TIMEOUT -> USER_STOP
INFO|wrapper|11-09-19 20:23:40|stop config name null
INFO|wrapper|11-09-19 20:23:40|externalStop false
INFO|wrapper|11-09-19 20:24:25|process did not stop after 45000 sec. -> hard kill
INFO|wrapper|11-09-19 20:24:25|killing 8989
INFO|wrapper|11-09-19 20:24:25|send kill sig
INFO|wrapper|11-09-19 20:24:25|exit code linux process 9
INFO|wrapper|11-09-19 20:24:25|Controller State: USER_STOP -> PROCESS_KILLED
INFO|8989/2|11-09-19 20:24:26|gobler execption OUTPUT 8989 null
INFO|8989/2|11-09-19 20:24:26|gobler execption ERROR 8989 null
INFO|wrapper|11-09-19 20:24:26|process exit code: 999
INFO|8989/2|11-09-19 20:24:26|gobler terminated OUTPUT 8989
INFO|8989/2|11-09-19 20:24:26|gobler terminated ERROR 8989

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

灼痛 2024-12-12 23:52:42

您可以通过附加 strace 来跟踪 linux 进程正在执行的操作到它。

如果这是 YAJSW 本身的问题,并且您正在寻找一个简单的包装器来保持您的工作正常运行,那么可以使用一个简单的 bash 脚本来完成。

until myjob; do
    echo "restarting myjob"
    sleep 10
done

只要 myjob 正在运行,第 1 行就是一个阻塞调用,如果它以 0 以外的任何值退出,那么它将重新启动。

You can trace what the linux process is doing by attaching an strace to it.

If it is a problem with YAJSW itself and if you are looking for a simple wrapper to keep your job up and running, it can be done with a simple bash script.

until myjob; do
    echo "restarting myjob"
    sleep 10
done

Line 1 is a blocking call as long as myjob is running and if it exits with anything other than a 0 then, it will be restarted.

时间你老了 2024-12-12 23:52:42

您可以查看:此处 - 这可能是资源泄漏。

You could look: here - this could be a resource leak.

撑一把青伞 2024-12-12 23:52:42

我在 Windows 上遇到了非常相似的包装器日志输出。就我而言,多个应用程序通过 yajsw 实例运行。在某些情况下,yajsw 用于监视 Java 应用程序的自动端口选择似乎无法正常工作。

在出现故障的 yajsw 实例中,添加

wrapper.port = 24572

可修复该问题。修改wrapper.conf后重新创建服务。我只需要将其添加到失败的 yajsw 实例中即可;其他实例自动选择端口成功。端口号并不重要,选择一个未使用的端口即可。

I ran into very similar wrapper log output on Windows. In my case, multiple applications were running through yajsw instances. It appears that in some cases, automatic port selection by yajsw to monitor Java applications doesn't work properly.

In the yajsw instance that is failing, adding

wrapper.port = 24572

fixes the issue. Recreate the service after modifying the wrapper.conf. I only had to add this to the instance of yajsw that was failing; other instances auto-selected ports successfully. The port number doesn't matter, just choose an unused port.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文