2
I have a problem where a Python process is hitting a segmentation fault but not producing a core file.
The following is a toy example that does not produce a core file on the following distros:
- Ubuntu 12.10
- Fedora 18
but does produce core files on the following distros:
- Scientific Linux 6
- Mac OS X
The reproduction:
$ python -c 'import time; time.sleep(120)'&
$ kill -abrt $! [1]+
Aborted python -c 'import time; time.sleep(120)'
$ ls core* ls: cannot access core*: No such file or directory
However, if I send a similar signal to a sleep
instance I do get a core file:
$ sleep 120 &
$ kill -abrt $!
[1]+ Aborted (core dumped) sleep 120
$ ls core*
core.8603
On my Fedora 18 box, here is my /proc/sys/kernel/core_pattern
:
$ cat /proc/sys/kernel/core_pattern
core
And I've set the following:
$ ulimit -c
unlimited
This is reproducible regardless of whether the abrtd
service is running or not.
I'm pretty sure I've missed some basic configuration, but I don't know what. Thanks!
EDIT: This may be solvable by running:
$ echo 1 >/proc/sys/fs/suid_dumpable
Although not directly related to the above example, if your python process happens to use the "daemon" module to put itself in the background that defaults to explicitly turning off core dumps. You need to set prevent_core=False in the DaemonContext to override that. – Eric – 2017-09-11T16:36:36.730
Is core a program on your system? What have you tried? Which of these has not solved your problem? https://wiki.ubuntu.com/Apport , http://ubuntuforums.org/archive/index.php/t-497562.html , http://stackoverflow.com/questions/5833218/coredumpdirectory-isnt-working-on-ubuntu-getting-segmentation-fault-in-apache2
– Ярослав Рахматуллин – 2013-07-20T08:06:31.057Did you try setting
suid_dumpable
to1
? (only root can do that) – pabouk – 2013-07-23T20:17:27.2001Please try following:
ls -lL $(which python) ; python -c 'import time; time.sleep(5)' & grep core /proc/$!/limits ; ls -ld "$(readlink /proc/$!/cwd)" ; grep ^Sig /proc/$!/status ; kill $!
The sequence will 1. list the Python binary to check if it is not suid; 2. list actual core limit of the process to check if it did not change; 3. list the working directory of the process to check if it is writeable by the user; 4. list signal masks of the process - please check if theSIGABRT
(6) showing as0000000000000020
is not blockedSigBlk
, ignoredSigIgn
or caughtSigCgt
. – pabouk – 2013-07-23T20:26:38.520