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.

5
  • 1
    Where does your script exit? Do you actually see a warning? Commented Jun 24, 2009 at 22:16
  • 2
    It might help to post the relevant chunk of code. Commented Jun 24, 2009 at 22:20
  • I am not sure how to figure out where the script exits. It seems to do its job really well (as my output is right) but exits with 137. I do a echo $status to see the exit code. Commented Jun 24, 2009 at 22:20
  • 1
    You are going to have to at the very least show the part of your shell script that invokes the perl script and show the "warning" that is output if you want people to be able to help you. (Just edit your question and add those things to it.) Commented Jun 25, 2009 at 0:15
  • Possible duplicate of What does 'killed' mean? Commented Apr 3, 2019 at 16:50

4 Answers 4

82

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.

Sign up to request clarification or add additional context in comments.

7 Comments

Not quite because running the script independently as well spits out 137. Thanks.
It is also possible that it sent itself the signal.
It's the oomkiller process that's killing it -- not the other script.
On Linux, check dmesg output to see if was the OOM Killer.
Can you elaborate on why you have "128" in your answer? Is that a known number, that increments from there?
|
53

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

1 Comment

oom_reaper messages are also in dmesg.
9

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

Comments

5

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.