Turning core dump on in linux


Results 1 to 6 of 6

Thread: Turning core dump on in linux

  1. #1
    Join Date
    Dec 2004
    Posts
    3

    Turning core dump on in linux

    Java is running on SUSE Enterprise linux version 8, can anybody let me know how to turn the core dump in linux so that i can dump of the threads/processes running on the system. I am trying to debug a java thread which is taking lot of cpu time and need to find out what java class is getting executed automatically.

    Please let me know what are the places that i need to turn on to have a core/thread dump and how to look into where the core/thread dump log file is when the required parameters are turned on.

    Any help would be greatly appreciated, thanks.
    Last edited by bingoblue; 12-17-2004 at 09:08 PM.

  2. #2
    Join Date
    Feb 2003
    Location
    New Jersey USA
    Posts
    62
    Sure... the command you want to run is ulimit. If you run "ulimit -a" you will get all the current settings on for your "session" The setting to enable core dumps is "ulimit -c value" where value is the size you want to allow for the core file, or the key word unlimited. If you limit the size, a core dump will get generated, but you may not be able to debug with it if the size is too small as it will get truncated.

    Hope this helps.

  3. #3
    Join Date
    Dec 2004
    Posts
    3
    Thank you very much ernieg for your reply. After issuing the following command :

    ulimit -c unlimited


    where does the core dump get generated, what directory should i look for it.

    Also is there any other parameter i need to turn on in any of the files for the dump to happen apart from the above command.

    Thank you for your effort and time.

  4. #4
    Join Date
    Apr 2001
    Location
    SF Bay Area, CA
    Posts
    14,936
    Originally posted by bingoblue
    where does the core dump get generated, what directory should i look for it.
    It should be generated in the process' (that is, Java's) current directory. But the process won't automatically dump core all the time -- you need to send it a signal (a signal whose default action is to terminate the process and dump core, such as signal 11) before it'll do that.

    Plus, core files are not human-readable. You won't be able to decipher the file itself. You'll need the debug symbols for the Java runtime, plus the debug symbols for your classes, plus a Java debugger (gdb might support Java, I'm not sure) to be able to make any sense of the core file.

    Maybe it would be a heck of a lot simpler to put some System.out.println() calls in your class so you can tell for sure what's executing?

  5. #5
    Join Date
    Dec 2004
    Posts
    3
    Thanks a lot bwkaz. The java processes i am trying to debug is running only at midnight and i am not sure what java class is executing at that time automatically and it consumes lot of CPU time. Looked for cron or scheduled jobs set up at that time but i cannot find what is set to run at that time.

    I looked in the /proc directory where some of the process is found but this java processes threads i think executes at that time and it is not stored which is making the debugging more difficult. Another thing in linux is that it has many child threads(forks) from the parent process which i think makes the debugging more difficult.

    So I am first trying to get a dump of that process at that time and then try to get the class name which is getting executed at that time automatically.

    So please let me know
    a. if there is a better way to debug a java process to get a java class.
    b. If there is a better way or command in linux which can let me know at a particular time range what java classes are scheduled to run.

    Thanks a lot for your effort and time.

  6. #6
    Join Date
    Feb 2003
    Location
    New Jersey USA
    Posts
    62
    Glad to help... as far as the location of the core its usually from where the core was started from (typically the directory from where the process was started.) However I have also seen in cases when the process is running as a daemon, the cores usually just get depositied in "/" root.

    Good luck with your debugging!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •