Operating System - Linux
1752793 Members
6220 Online
108789 Solutions
New Discussion юеВ

Using ulimit to get corefiles (points!)

 
SOLVED
Go to solution
Christian Deutsch_1
Esteemed Contributor

Using ulimit to get corefiles (points!)

Hi folks,

In the past I have used ulimit to get crashing processes to write corefiles:

ulimit -H unlimited
ulimit -Hc unlimited
ulimit -S unlimited
ulimit -Sc unlimited

But this is only (?) for processes started from the same shell after the ulimit commands have been started.

Is there a good way to be sure that I always get corefiles, from any process, also after reboot? Solaris and HP-UX 11.31 have coreadm but it seems this is not available for Linux? I am using RHEL5u1 on x86.

The first seven truly helpful answers will be generously rewarded with points!

Thanks, Christian
Yeshua loves you!
11 REPLIES 11
Matti_Kurkela
Honored Contributor
Solution

Re: Using ulimit to get corefiles (points!)

These RedHat Knowledge Base articles should be appropriate to you:

How to enable core dumps on *everything* on RHEL 5.*:
http://kbase.redhat.com/faq/docs/DOC-5353

How to enable core dumps on Apache webserver (taking care that the dumps are stored in a safe location):
http://kbase.redhat.com/faq/docs/DOC-1468

For more info on kernel.core_pattern sysctl setting, please see:
http://www.kernel.org/doc/Documentation/sysctl/kernel.txt

MK
MK
Steven E. Protter
Exalted Contributor

Re: Using ulimit to get corefiles (points!)

Shalom,

By default you get core files.

ulimit -Sc 0 to prevent core files.

Then override it in the applications start up script or user profile.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Matti_Kurkela
Honored Contributor

Re: Using ulimit to get corefiles (points!)

SEP,
in RHEL (and most modern Linux distributions) the "factory default" is no corefiles. It may be that the kernel default is as you said, but the startup scripts will override the kernel defaults pretty thoroughly.

This is another case of "beginner-friendliness".
As the default is no core files, those that don't know what core files are and what to do with them won't have to wonder why a crashing Java server application suddenly ate a gigabyte of disk space. (I've seen that on HP-UX, and educated the application guys shortly afterwards :-)

Those that know what to do with core files, certainly should also know how to enable them when necessary (as Christian obviously does). And if the basic policy needs to be changed, the Red Hat Knowledge Base link in my first reply covers that.

MK
MK
Christian Deutsch_1
Esteemed Contributor

Re: Using ulimit to get corefiles (points!)

Thanks Matti, that's extremely helpful :)

Thanks Steve for your input. I did not check if it was the default but I did not find any corefiles so far and I was wondering if that was maybe suspicious (testing some software).

After making the recommended changes I did a simple test and got my corefile, thank you so much!

Kind regards, Christian
Yeshua loves you!
dirk dierickx
Honored Contributor

Re: Using ulimit to get corefiles (points!)

it's disabled by default because most corefiles are uninteresting or nobody looks at them, or in a lot of cases just don't give you any more information.
if and when specificly needed, it can be turned on quickly.
dirk dierickx
Honored Contributor

Re: Using ulimit to get corefiles (points!)

also, i don't call it 'beginner friendlyness', it's 'makes good sense defaults'. i certainly like the userland more on linux then hpux where almost _nothing_ has a decent default value.
Christian Deutsch_1
Esteemed Contributor

Re: Using ulimit to get corefiles (points!)

Hi folks,

Sorry my testing was not yet thorough enough. When I kill a daemon process with kill -11 I get NO COREDUMP! I sent RedHat feedback to their webpage, don't know if they will send me a reply but I told them the information is wrong (at least partially wrong, at least as far as some daemon processes are concerned).

If you have any helpful hints that would be very helpful for me, otherwise I will see if I am able to get support from RedHat directly.

Thanks, Christian
Yeshua loves you!
Christian Deutsch_1
Esteemed Contributor

Re: Using ulimit to get corefiles (points!)

My colleague suggested that I hack the init script for the software that I am testing and to add the ulimit commands in there. I will use the hack until I find a better solution.
Yeshua loves you!
Heironimus
Honored Contributor

Re: Using ulimit to get corefiles (points!)

The process needs permission to write the core dump to its working directory, which not all daemons will have.