In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Recently, there is a problem in the project that the server-side program will suddenly crash and exit. We have adopted coredump technology to find out the cause of the crash, that is, to determine which function is being executed when the process exits and its status.
If coredump is enabled in the system, exactly if coredump is enabled in the current shell environment, when the program in the current shell environment crashes and exits, the memory state of the stack of the process at that time will be written to the core file. Use gdb to view the state of the stack saved in this core file, gdb a.out core. (for the opening of coredump and the understanding of shell, please refer to my blog "using dotnet-dump to find the reasons why .net core 3.0 occupies 100% of CPU", and for gdb, please refer to "use and Summary of gdb debugging commands")
The location generated by the core file defaults to the location of the executable file, the name defaults to core, and its location and name can be set. My setting is:
Mkdir / home/corefile echo "/ home/corefile/core-%e-%p-%t" > / proc/sys/kernel/core_pattern
In this way, the generated core file will be placed in the / home/corefile directory, and the core file name will appear in the form of core-%e-%p-%t, where% e represents the name of the executable file,% p represents the process, and% t indicates the time when the core file was generated (note that it is unix time).
Here is a routine that can cause coredump:
Underlining will lead to coredump. After execution, the following files are generated in the / home/corefile directory:
[root@localhostwin7] # ls / home/corefile/
A.out is the executable file name, and 5082 is the PID,1490760381 is the unix time when the file was generated. Put the a.out and core files in the same directory and use the command:
Gdb a.out core-a.out-5082-1490760381
Enter gdb, and then use the backtrace command to see the memory state of the stack when the process exits, as shown below:
As you can see, when the process exits, the last function executed is the square function. -
Summary
The above is the Linux introduced by the editor to use coredump technology to trace the cause of the collapse of the process. I hope it will be helpful to you. If you have any questions, please leave a message for me. The editor will reply to you in time!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.