1

I have a crashing application, which crashes with the output: Aborted (core dumped).

Now when I look at the directory, containing the binary, there is no crashdump.

  • There is no core directory.
  • There is free space on the filesystem
  • User can create files in the directory.

ulimit -a prints

core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31845
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65536
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31845
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

cat /proc/sys/kernel/core_pattern prints

core

cat /proc/sys/fs/suid_dumpable prints

2

Is there anything else I can check? I am out of ideas.

Am running on Ubuntu 15.04.

2
  • Some OS allow to configure a systemwide directory where to put core files

  • The program may have changed it's working directory. The core file is in the working directory of the program that dumped core

  • If ulimit -c 0 was issued, the shell message should not print "core dumped" unless the OS is buggy

| improve this answer | |
  • 1
    The program switched the working directory. – abergmeier Sep 23 '15 at 13:15
0

To generate core dump on Linux we can add below parameters in initialize script which runs our executable. So whenever we initialize software or run our application and export environment variables we can copy the below lines to the script as well to dump core in case if we see any crash.

To set the location of core dumps you can set the core file path using the proc file system.

For example, if you want core dumps in /tmp/crash/corefiles. This will make sure your core file generation path remains intact for the processes you ran using the script.

mkdir -p /tmp/crash/corefiles
chmod 775 /tmp/crash/corefiles
echo "/tmp/crash/corefiles/%e.%s.core" > /proc/sys/kernel/core_pattern

Where variables are:

%e is the filename
%g is the gid the process was running under
%p is the pid of the process
%s is the signal that caused the dump
%t is the time the dump occurred
%u is the uid the process was running under

Also, you have to set the core file size, below command sets the core file size to unlimited

ulimit -c unlimited

Now to check the core file size set for each thread within a process we can check using

cat /proc/<PID>/limits

The output of above command:

Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        unlimited            unlimited            bytes     
Max open files            10000                10000                files     
Max address space         unlimited            unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             31868                31868                processes 
Max locked memory         65536                65536                bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       31868                31868                signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us      

As we can see from the above output max core file size is set to unlimited.

In your case, you can follow the below steps.

  • Create an initialize script which contains all environment exports as well as the above core file generation related changes.
  • From initializing script trigger your application.
  • When there is a crash you should be able to see the core file as per the core file location you have set.
  • You can verify the core_pattern using: cat /proc/sys/kernel/core_pattern and see if your location is set correctly or not.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.