开发者

What is the meaning of error code 24 on Linux?

I'm running a Java program through a Python script on Linux, but the program crashes without outputting any er开发者_C百科ror messages. The os.system command that executes the Java program outputs an error code of 24. What does this mean?


On my system this is found in /usr/include/asm-generic/errno-base.h:

#define EMFILE      24  /* Too many open files */

This means your process has exceeded the limit on C/system file descriptors. Generally the limit is around 1024, there may be a bug in that some file descriptors are not being closed. (This would seem unlikely in Python or Java code where it's done for you...).

Update0

I've just realised you may be talking about the return code from the Java program. This is program specific, you'll need to check the documentation or code for the program.


From http://docs.python.org/library/os.html#os.system:

On Unix, the return value is the exit status of the process encoded in the format specified for wait(). Note that POSIX does not specify the meaning of the return value of the C system() function, so the return value of the Python function is system-dependent.

Luckily, the C macros used to dissect the return status are available in the os module (starting here)

I ran these on amd64/Linux:

>>> import os
>>> os.WIFEXITED(24) #Return True if the process exited using the exit(2) system call
False
>>> os.WIFSIGNALED(24) #Return True if the process exited due to a signal
True
>>> os.WTERMSIG(24) #Return the signal which caused the process to exit
24

According to http://linux.die.net/man/7/signal, I think signal 24 may be SIGTSTP, (someone stopped the process by hitting CTRL+Z). What platform/architecture are you running on?

(Going forward, I would recommend using the subprocess module so that you can capture stdout/stderror)

update

Someone had posted it and then it disappeared, but signal 24 is likely SIGXCPU (CPU time limit exceeded)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜