At the same time, through the introduction of the following two examples, consolidate the above analysis of the problem of the introduction:
Analysis of the performance problem of a multi-threaded application an crash problem
UNIX program http://www.aliyun.com/zixun/aggregation/17253.html "> FAQ category
Running programs under UNIX often encounters the following types of problems:
Crash memory leak handle leak process does not respond performance does not meet expected logic error
Analysis methods of common problems in UNIX programs
Analysis method of Crash problem under UNIX
Crash principle and Core file generation reason (introduction of signal)
Crash is a process crash, because the application process has done the wrong thing (for example, the array copy crosses the line causing the system memory to write, using the wrong pointer address), the operating system sent signals to the application process, if the application process does not do special processing, the application process will be core dump A core file is generated in the current working directory of the process, and the core file copies the stored image of the process, which is a memory image.
Not all of the signal default behavior is crash, the common default crash signal mainly:
SIGABRT Sigbus SIGSEGV Sigill sigpipe
You can view signal information through KILL–L (for all UNIX platforms).
View the default behavior for all signals for a process (for example, using the psig PID command on the Solaris platform, with commands from other platforms slightly different, refer to the respective Platform user manual).
[root@svs4qa09 SunOS a]# psig 25040 25040:/qatest/modelerserver/5.0.0.0.64/modelersrv_15_0-server HUP caught 0x10002958c 0 INT caught 0x100029580 0 QUIT default ILL default TRAP default ABRT default EMT default FPE default KILL default bus Default SEGV default SYS default PIPE ignored alrm default TERM caught 0x100029580 0 USR1 default USR2 default CLD caught 0x100067f44 Nocldstop
The following is a list of the default actions for common signals and the possible causes:
For example, the Solaris platform is as follows. The following information refers to the Solaris kernel structure version 2nd (Solaris process Model) page 75th, the other platforms are basically the same, please refer to their respective platform user manuals:
Signal value processing action signals the reason
Sighup The default action is to terminate the process terminal suspension or control process termination
SIGINT The default action is to terminate the process keyboard interrupt (for example, the break key is pressed)
Sigquit The default action is to terminate the process and perform a kernel image dump (dump core) keyboard exit key is pressed
Sigill The default action is to terminate the process and perform a kernel image dump (dump core) Illegal instruction
SIGABRT The default action is to terminate the process and perform a kernel image dump (dump core) exit instruction issued by abort (3)
SIGFPE The default action is to terminate the process and perform kernel image dumps (dump core) floating-point exceptions
SIGKILL 9 AEF kill signal termination signal
SIGSEGV The default action is to terminate the process and perform a memory reference that is not valid for kernel image dumps (dump core)
Sigpipe The default action is to terminate the process pipeline rupture: write a pipe without a read port
SIGALRM The default action is to terminate the process by alarm (2) signal
Sigterm The default action is to terminate the process termination signal
SIGUSR1 The default action is to terminate the process user custom signal 1
SIGUSR2 The default action is to terminate the process user custom signal 2
SIGCHLD The default action is to ignore this signal sub process end signal
SIGSTOP DEF Terminate Process
Sigbus The default action is to terminate the process and perform a kernel image dump (dump CORE) bus error (incorrect memory access)