Signals used by the JVM

gangyaocn發表於2012-12-26

The following Table below shows the signals that are used by the JVM. The signals have been grouped in the table by type or use, as follows:

  • Exceptions: The operating system synchronously raises an appropriate exception signal whenever a fatal condition occurs.
  • Errors: The JVM raises a SIGABRT if it detects a condition from which it cannot recover.
  • Interrupts: Interrupt signals are raised asynchronously, from outside a JVM process, to request shutdown.
  • Controls: Other signals that are used by the JVM for control purposes.
Table 2. Signals used by the JVM
Signal NameSignal typeDescriptionDisabled by -Xrs
SIGSEGVExceptionIncorrect access to memory (write to inaccessible memory)No
SIGILLExceptionIllegal instruction (attempt to invoke an unknown machine instruction)No
SIGFPEExceptionFloating point exception (divide by zero)No
SIGBUSExceptionBus error (attempt to address nonexistent memory location)Yes
SIGSYSExceptionBad system call issuedYes
SIGXCPUExceptionCPU time limit exceeded (you have been running too long)Yes
SIGXFSZExceptionFile size limit exceededYes
SIGEMTExceptionEMT instruction (AIX specific)Yes
SIGABRTErrorAbnormal termination. The JVM raises this signal whenever it detects a JVM fault.Yes
SIGINTInterruptInteractive attention (CTRL-C). JVM exits normally.Yes
SIGTERMInterruptTermination request. JVM will exit normally.Yes
SIGHUPInterruptHang up. JVM exits normally.Yes
SIGQUITControlA quit signal for a terminal. JVM uses this for taking Javadumps.Yes
SIGTRAPControlInternal for use by DBX or ptrace. Used by some JVMs for internal control purposes.No
SIGPIPEControlA write to a pipe that is not being read. JVM ignores this.No
No Name (40) An AIX reserved signal. Used by the AIX JVM for internal control purposes.No

Use the -Xrs (reduce signal usage) option to prevent the JVM from handling most signals. For more information, see Sun's Java application launcher page at.

Do not use the -qflttrap C compiler setting because it provides the possibility of SIGTRAPs being generated, which might then impact the JIT. If you want to have floating point exceptions generated, include this call in your code:

fp_trap( FP_TRAP_SYNC)

so that it generates a SIGFPE signal.

If you install a signal handler for signal numbers 5 (SIGTRAP) or 40, you impact JVM performance because these signals are used for internal control purposes.

Signals 1 (SIGHUP), 2 (SIGINT), 4 (SIGILL), 6 (SIGABRT), 7 (SIGEMT), 8 (SIGFPE), 10 (SIGBUS), 11 (SIGSEGV), 12 (SIGSYS), 15 (SIGTERM), 24 (SIGXCPU) , and 25 (SIGXFSZ) cause the JVM to shut down; therefore, an application signal handler must not attempt to recover from these unless it no longer requires the services of the JVM.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26651/viewspace-751660/,如需轉載,請註明出處,否則將追究法律責任。

相關文章