The Sun java vm crashes sometimes when it receives a SIGUSR2 while running a swing application
Issue
The following information has been provided by Red Hat, but is outside the scope of the posted This content is not included.Service Level Agreements and support procedures. The information is provided as-is and any configuration settings or installed applications made from the information in this article could make the Operating System unsupported by Red Hat Global Support Services. The intent of this article is to provide information to accomplish the system's needs. Use of the information in this article at the user's own risk.
Issue
- The Sun java vm crashes sometimes when it receives a SIGUSR2 while running a swing application
Environment
- Red Hat Enterprise Linux
- java-1.6.0-sun-1.6.0.20-1jpp.1.el5
Resolution
SIGUSR2 is used internally by the Sun jvm for suspend/resume. Sending this signal externally may result in undefined behaviour. If it is necessary for the application to use SIGUSR2 for some reason, one could change the signal to be used for suspend/resume by defining the environment variable _JAVA_SR_SIGNUM to that signal number. The number should be higher than the maximum of SIGSEGV and SIGBUS.
Diagnostic Steps
1. Start any swing application. Following is a sample application:
import javax.swing.JFrame;
import javax.swing.JLabel;public class HelloWorldFrame extends JFrame {
public static void main(String args[]) {
new HelloWorldFrame();
}
HelloWorldFrame() {
JLabel jlbHelloWorld = new JLabel("Hello World");
add(jlbHelloWorld);
this.setSize(100, 100);
// pack();
setVisible(true);
}
}
2. Find the pid for the java process for example using
ps -u $USERNAME | grep java
3. Send SIGUSR2 to this pid using kill
kill -s USR2 <pid of java process>
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.