I wanted my C++ application to produce core dumps when it crashed, so I followed this advice: https://stackoverflow.com/questions/2065912/core-dumped-but-core-file-is-not-in-the-current-directory

Sometimes, when it crashes it produces a single core file in the directory when it was started (e.g. my home directory), and sometimes it creates a file named _usr_bin_<app_nam>.1000.crash in /var/crash. It looks like two different mechanisms were responsible for creation of these files.

The application and its debug symbols is installed from a debian package to /usr/bin (it is build as RELEASE_WITH_DEBUG_INFO).

Here is some of the relevant configuration:

$ cat /proc/sys/kernel/core_pattern
|/usr/share/apport/apport %p %s %c %d %P %E

$ cat /etc/apport/crashdb.conf
databases = {
    'ubuntu': {
        'impl': 'launchpad',
        'bug_pattern_url': 'http://people.canonical.com/~ubuntu-archive/bugpatterns/bugpatterns.xml',
        'dupdb_url': 'http://people.canonical.com/~ubuntu-archive/apport-duplicates',
        'distro': 'ubuntu',
#        'problem_types': ['Bug', 'Package'],
        'escalation_tag': 'bugpattern-needed',
        'escalated_tag': 'bugpattern-written',

$ ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 63058
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
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) 63058
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

The # in the crashdb.conf file was inserted to enable apport , as recommended here: https://wiki.ubuntu.com/Apport

Also, when I am opening the core file from my home dir in gdb, it says: BFD: Warning: core is truncated: expected core file size >= 2697007104, found: 2147479552. and it failed to read a valid object from the memory. It should not be a problem with free disk space.

What is exactly the reason of producing two types of core dumps?


Your Answer

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

Browse other questions tagged or ask your own question.