Linux Core dump analysis and related debugging

Source: Internet
Author: User

core is a core dump file and a mechanism for Linux servers. core is a serious problem in a program that causes the program to hang up and need to be restored.

something to watch out for

In the process of the program hangs, the program's memory information and CPU call stack information, when the program occupies a large amount of memory, such as 40G, the core file may reach 60G, the file will last a few 10 minutes, so long traffic will be lost, and write large files on the Wio occupies a particularly large, Other services that seriously affect the server, for online services, will be a lot of timeouts, or serious is not available for a period of time to provide services. Therefore, core file monitoring, size control is also important.

cause of the production The core file produces many reasons, there are active core requests, there is the illegal operation of the program causes the OS to send SIGSEGV related signals. Active core approach: 1) The program is running, you need to look at the process inside or the running of the thread, and actively generate core. GDB Attach process number first then use the Generatercore command to generate the core 2) Send Kill command Passive core: This is due to the illegal operation of the program, such as illegal write memory, illegal reading, such as triggering the OS Protection program, the OS sends the relevant signal to the program, resulting in the program core dropped. core-related Settings 1) Modify the/proc/sys/kernel/core_pattern file,

This file is used to control the file name produced by the core file, and by default, the file contains only one line of content: "Core", this file supports customization, generally use% with different characters, here are a list of several:

%p The PID of the core process
%u out of core process UID
%s causes the signal number of the core
%t time from core, number of seconds starting from 1970-01-0100:00:00
%e the executable file name corresponding to the core process
2) ulimit-c This command shows the current OS limit on the core file size, or 0, which means the core file is not allowed to be generated. If you want to make changes, you can use ulimit-c n n represents the core file size limit ulimit-c Unlimited No Limit size The purpose of core The core file is quite useful, and the core file is equivalent to saving the program out of the wrong site to the programmer to debug, looking for problems. It saves the program's call stack information, memory information, and CPU usage information. Commissioning Technology

Debugging with GDB:

GDB program Core uses the BT view stack using info threads to view thread information threads n jump into the corresponding thread inside, debug F N jump to the corresponding stack inside go p print variable


Linux Core dump analysis and related debugging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.