6

I have a python script which uses subprocess.Popen to run multiple instances of another python script, each operating on a different file.

I have a collection of 300 files which I run through this process for testing purposes. every run, a random number of files fails, always different files, so there is nothing wrong with the files themselves, but the subprocess exits with either error code -6 or -11 when it happens. and if I run the script again with the same input files it runs successfully.

What are -6 and -11? can they be correlated to python exceptions?

Edit To Clarify: The scripts are actually django management commands. I have a large try: except clause which catches any exceptions and calls sys.exit(1), so failure is happening outside of my code. possibly in loading other modules. i've checked the django source code and it seems to always call sys.exit(1) in the event of any errors too, so the -6 and -11 appear to be coming from a lower level. i'm thinking they may be oserrors related to race conditions, but I can't be sure about that.

user61000
  • 540
  • 5
  • 10

1 Answers1

13

Are you getting the exit status from mysubproc.returncode?

From http://docs.python.org/library/subprocess.html#subprocess.Popen.returncode:

A negative value -N indicates that the child was terminated by signal N (Unix only).

Signals 6 & 11 are SIGABRT (abort) and SIGSEGV (segfault) ( http://linux.die.net/man/7/signal ). My guess is that those other scripts are running into badness with an extension or one of the libraries that an extension depends on. You may have a bad build then - either recompile if you did so manually or see if there's an updated package.

Jeremy Brown
  • 17,880
  • 4
  • 35
  • 28
  • This is exactly what I was looking for.. thanks a ton. out of curiosity, what can cause SIGABRT? – user61000 Sep 02 '10 at 19:39
  • @user61000 - From what I understand, it's usually from the C/C++ runtime's memory management - like with double deleting, etc. It'll in turn call abort() which basically makes the process signal the SIGABRT to itself. That would seem to go hand in hand with invalid memory references...sounds like there's some bad pointer/memory management in one of the libraries. – Jeremy Brown Sep 02 '10 at 19:49
  • @user61000 - this answers the question about where SIGABRTs come from :) http://stackoverflow.com/questions/3413166/when-does-a-process-get-sigabrt-signal-6 – Jeremy Brown Sep 02 '10 at 19:55
  • Thanks Jeremy, now that I know its not something I can control, I can just catch those codes and re-add the files to the queue, that seems to work just fine. – user61000 Sep 02 '10 at 20:05