cs at zip
Apr 9, 2012, 4:24 PM
Post #10 of 12
On 09Apr2012 12:02, Janis <janis.viksne [at] gmail> wrote:
Re: Python randomly exits with Linux OS error -9 or -15
[In reply to]
| Thank you all for the help! I will need to think a bit about the other
| But, Alan, as to this:
| > > How do you get -9 and -15? Exit status is supposed to be between 0 and
| > > 127.
| I have the following code that has caught these:
| p = subprocess.Popen([Config.PYTHON_EXE,'Load.py',"%s" % (row,)],
| bufsize=0, executable=None, stdin=None, stdout=None,
| stderr=subprocess.PIPE, preexec_fn=None, close_fds=False, shell=False,
| stdout, stderr = p.communicate()
| if p.returncode != 0:
| So you say it's SIGKILL and SIGTERM? Then I guess these could be
| misleading statuses from those cases when I have terminated the
| sessions myself, and when there is the real problem apparently the
| caller detected nothing here. SIGKILL and SIGTERM would probably also
| explain why there was nothing in stderr.
It is certainly SIGKILL and SIGTERM. See citation from docs below.
Background: wait() and its modern counterpart waitpid() put the process exit
status into an int, which is signed.
The exit status seen _in_the_shell_ is as described (0-255) but the raw
status from the OS is encoded in an int, and will generally be negative
is the process terminated from a signal. You're meant (in C) to inspect
it via a set of macros which understand this stuff.
If you read the documentation for the subprocess module it says:
The child return code, set by poll() and wait() (and indirectly by
communicate()). A None value indicates that the process hasnâ€™t terminated
A negative value -N indicates that the child was terminated by signal N
So there you go. SIGKILL and SIGTERM, definitely.
RTFM. It is your friend.
Cameron Simpson <cs [at] zip> DoD#743
Gabriel Genellina: See PEP 234 http://www.python.org/dev/peps/pep-0234/
You've got to love a language whose documentation contains sentences
beginning like this:
"Among its chief virtues are the following four -- no, five -- no,
six -- points: [...]"
from python-list [at] python