1828658 Members
1953 Online
109983 Solutions
New Discussion

core files configuration

 
SOLVED
Go to solution
Stanimir
Trusted Contributor

core files configuration

Hi all!
I need to configure core-files,generated by 1 of my applications,in order to copy many cores /they overwrite each other by now/ and to investigate it.

1) Make a convention name to the core files such as:
process_name.process_id
The new core format for the user "user1":

core.process_name.process_id

For example:
core.user1.17441

2)Limit the core file to 1G.

Whuch way I could do this.
Please help.

6 REPLIES 6
Ivan Krastev
Honored Contributor

Re: core files configuration

If you are with 11v3 use coreadm - http://docs.hp.com/en/B2355-60130/coreadm.1M.html

Unfortunately its not available in v2.

regards,
ivan
Ludovic Derlyn
Esteemed Contributor

Re: core files configuration

hi

to evit disk full in / ihave created a link for core to /var/adm/crash

perhaps for you, an solution is to create a link for each users

No size limit are specified in my case.

regards

L-DERLYN
Dennis Handly
Acclaimed Contributor

Re: core files configuration

>2)Limit the core file to 1G.

You can use: ulimit -c $((1024*1024*2))

Note: limiting a core file makes it near useless if it is larger. In IPF, the stack segments are dumped last and if they are missing you wouldn't get a stack trace.
Bill Hassell
Honored Contributor

Re: core files configuration

> Make a convention name to the core files...

Already available for 11.11, 11.23 and 11.31. As mentioned, 11.31 has coreadm, but for 11.11 and 11.23, there is a secret (well, not well documented) way to do this. The kernel parameter core_addpid will do exactly what you want, that is, every core file will have the PID added to the end of the filename. Here is how to do it:

11.11
echo â core_addpid/W 1â | adb â o â w /stand/vmunix /dev/kmem

11.23
echo â core_addpid/W 1â | adb â k â w /stand/vmunix /dev/kmem

This is not settable in SAM (hence, secret, undocumented) but you can set the value with a start-script so it always exists for your system. (there is no core_addpid location prior to 11.11)

And as mentioned, ulimit -C can limit the core file size. Lesser known are the -H and -S options to ulimit -c. By default, ulimit -c sets the maximum core file size. Once you lower it, it cannot be raised in the current environment. So, ulmit -c 1000 is the same as ulimit -Hc 1000 and ulimit -HC 2000 will fail because it cannot be raised. But use the -S option and now you can change the limit at any time during your session.

A common technique is to use ulimit -Sc 0 in /etc/profile so that no one can create a core file unless they specifically increase the value. Then developers can set ulimit -Sc 1000000 (or whatever) in their .profile or just pick a core dump size for each test.


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor
Solution

Re: core files configuration

Sorry about the awful characters in the adb commands - here is how they are supposed to look:

11.11
echo "core_addpid/W 1" | adb -o -w /stand/vmunix /dev/kmem

11.23
echo "core_addpid/W 1" | adb -k -w /stand/vmunix /dev/kmem


Bill Hassell, sysadmin
Ivan Krastev
Honored Contributor

Re: core files configuration

And a little addition: if the process is started as root and after that it switch his id to another (like apache) command is:
enable:
#echo 'dump_all/W0x1' | adb -w /stand/vmunix /dev/kmem

disable:
#echo 'dump_all/W0x0' | adb -w /stand/vmunix /dev/kmem

regards,
ivan