The Sun java vm crashes sometimes when it receives a SIGUSR2 while running a swing application

Solution Unverified - Updated -

Issue

The following information has been provided by Red Hat, but is outside the scope of the posted 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>

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content