Chinaunix首页 | 论坛 | 博客
  • 博客访问: 47382
  • 博文数量: 11
  • 博客积分: 450
  • 博客等级: 下士
  • 技术积分: 100
  • 用 户 组: 普通用户
  • 注册时间: 2005-11-25 17:05
文章存档

2005年(11)

我的朋友

分类: LINUX

2005-12-31 14:16:22

Errors:Troubleshooting crash signals
 

Why did I get a SEGV and other signals explained.

Signals are used to communicate an important event to a process. Once a process has received
a signal it will stop whatever it was doing, hence a software interrupt, and will either ignore it if possible, or execute some special code, a signal handler. Every signal has a default handler, although a process can use a customized handler instead.

As a user, when you see a crashed program you are really seeing the action of a signal handler
which is often the default handler for a fatal signal. Many OS''''es use the same set of signals and
signal numbers as defined in a POSIX specification. However beyond that set is often
implementation dependent. The following list is the current Linux 2.6 kernel with glibc 2.4.

1) SIGHUP Signal HangUp

SIGHUP is received when a process that started this application has died or when the command
line, known as the controlling terminal for this process was using, has received a hangup request.

On some systems, logging in, running an application and then exiting would generate this signal
which would often result in your application exiting. Adding the nohup to the start of command
would prevent the signal from being received by the application and allow it to continue running.

System processes like cron are happy to receive SIGHUP. SIGHUP instructs the cron process to
reload its configuration files.


2) SIGINT Signal Interrupt

SIGINT is normally generated from a keyboard, the default is often ctrl-c and it is sent to process
running on that controlling terminal, ie in the foreground. Many applications will exit when
receiving a SIGINT

3) SIGQUIT Signal Quit

SIGQUIT, often configured as ctrl is used to tell the process in this controlling terminal to nominally
exit. It however is often trapped by applications and in the case of many Java JVMs they use it
as a trigger to generate a Java stack trace and to not quit at all. Like SIGHUP, nohup can be
used to prevent applications from also receiving SIGQUIT

4) SIGILL Signal Illegal Instruction

SIGILL is fairly rare but says what it implies. An opcode for the machine architecture is actually
invalid. This signal is actually generated from the hardware trap handler to the kernel. Either the
machine code sent to the chip was corrupted or wasn''''t compatible with the chipset or a buggy
compiler or an interpreter environment were the cause of something this bad.


5) SIGTRAP Signal Trap

A signal resulting from a trace or breakpoint being set. Process tracing tools,like ptrace and strace
are consumers of these events, as are debug tools.

6) SIGABRT Signal Abort

Terminate process and dump a core file image. Often called by an application itself by use of the
abort() system call

7) SIGBUS Signal Bus Error

A hardware derived signal that is received by the kernel. The hardware found an address alignment
issue, ADRALN or an address that did not exist, ADRERR or an underlying error reported by a
file object, OBJERR when accessing the memory bus. In the case of OBJERR more details are
reported from the object itself. Often like many other signals you may here developers refer to this as simply a SIGBUS error or BUS error.

8) SIGFPE Signal Floating Point Exception

A hardware derived signal from the floating point unit. Normally an overflow or underflow of the value
being computed or more commonly a divide by zero in application code.

9) SIGKILL Signal Kill

Terminate a process without any cleanup. Process are not able to ignore SIGKILL although there are
some circumstances where a program may not receive a SIGKILL as the system is
unstable, the kernel for example is IO bound.

10) SIGUSR1 Signal User 1

The first of 2 signals that are used by applications themselves to signal user defined operations

11) SIGSEGV Signal Segmentation Violation

A SIGSEGV is a very common signal, often the result of a trying to access an invalid segment of
memory, most typically 0. However some applications such as a JVM use SIGSEGV to manage has exhausted its currently memory. The default handler will try and dump an image of the
process when the signal was caught, this image or core file can then be used with a debug tool
and the original application to generate a trace of the fault when it occurred. As a process can
consume a large amount of memory some operating systems reset the size of a core file to 0
using the ulimit command. You can remove this restriction using ulimit -c unlimited. As for SIGBUS, developers often refer to this signal simply as SEGV, or a SEGV error.

12) SIGUSR2 Signal User 2

The second of 2 signals that are used by applications themselves to signal user defined operations

13) SIGPIPE Signal Pipe

A process has tried to write to a socket or a unix pipe yet there was no other process reading from
that pipe. This signal indicates a broken pipe which can occur when the server side process has
died, leaving the process file descriptor ids still live.

14) SIGALRM Signal Alarm

The alarm signal is used by timing operations such as sleep to notify that a timer has expired. The
time unit used by SIGALRM is wall clock time.

15) SIGTERM Signal Terminate

Gently terminate this process and call any exit handlers

17) SIGCHLD Signal Child

The forked child process reported a status change, such as an exit

18) SIGCONT Signal Continue

Make a process continue after a request to stop. Often used by debugging tools


19) SIGSTOP Signal Stop

Stop the process. Often used by debugging tools, if the signal is from the terminal then SIGTSTP is
used instead.

20) SIGTSTP Signal Terminal Stop

This signal is often generated using the suspend key sequence, ie ctrl-Z

21) SIGTTIN Signal Stopped on TTY Input

This signal is most commonly generated when a process cannot read from the terminal because it
has been placed into the process background.

22) SIGTTOU Signal Stopped on TTY Output


This signal is most commonly generated when a process cannot write to the controlling terminal
because it has been placed into the process background.


23) SIGURG Signal Urgent

Urgent data is available on the socket.

24) SIGXCPU Signal Exceeded CPU limit

Exceeded CPU time quota limit.

25) SIGXFSZ Signal Exceeded File Size

Exceeded maximum file size quota

26) SIGVTALRM Signal Virtual Alarm

Signal when virtual time is expired. Virtual time uses process time and not wall clock time.

27) SIGPROF Signal Profiling

Used by profiling tools. Sends a signal when the time has expired for this process including system

28) SIGWINCH Signal Window Changed Size

The terminal window has changed size, more important for graphical curses based applications.

29) SIGIO Signal IO

IO data has become available

30) SIGPWR Signal Power Failure

Power has failed and process is now using UPS

31) SIGSYS Signal System Call

A system call to the kernel has failed

34) SIGRTMIN Signal Real Time Minimum


Note: Earlier Linux definitions used 32 for SIGRTMIN and this signal was often used by applications
like the JVM for it''''s own internal use.

35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3 38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8 43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13 48) SIGRTMIN+14 49) SIGRTMIN+15

50) SIGRTMAX-14 Signal Real Time Maximum

Signal used when running a process in Real time mode. 51) SIGRTMAX-13 52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7 58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2 63) SIGRTMAX-1 64) SIGRTMAX

阅读(1428) | 评论(0) | 转发(0) |
0

上一篇:uClinux的内存管理

下一篇:没有了

给主人留下些什么吧!~~