Why does my Perl script exit with 137?

2019-01-17 09:49发布

Is there a way to eliminate a warning (exit code 137) in perl? I am running a Perl script on linux within another shell script. This Perl script exits with a warning and exit code 137. I could not pinpoint what exit code 137 stands for.

What is the best way to avoid this warning? I tried "no warnings" in the script and I have an exit 0 at the end of my Perl script as well.

4条回答
手持菜刀,她持情操
2楼-- · 2019-01-17 10:04

I got the same error code 137 from an ANT script. Looking at /var/log/messages, I understand it's out of memory error.

Jun 21 07:33:30 myhost kernel: Out of memory: Kill process 52959 (java) score 164 or sacrifice child
Jun 21 07:33:30 myhost kernel: Killed process 52959 (java) total-vm:709496kB, anon-rss:397016kB, file-rss:0kB
查看更多
forever°为你锁心
3楼-- · 2019-01-17 10:09

I just ran into the same exit code 137 when launching a python script. It turns out to be the OOM killer kicking in, sending SIGKILL to python interpreter. If it's the same cause, you can find oom msgs in /var/log/messages

查看更多
神经病院院长
4楼-- · 2019-01-17 10:20

I suspect the exit warning is printed out by the shell which called the perl program, not by the perl program itself, so "no warnings" in the perl code won't help you. exit code 137 means it was killed with a SIGKILL signal.

查看更多
Melony?
5楼-- · 2019-01-17 10:28

137=128+9, which means some other process has sent you a signal 9, which is SIGKILL. I.e. the other script kills yours, that's what it looks like.

查看更多
登录 后发表回答