JDK-6381526 : Unexpected async exception in jvmti_GetLoadedClasses()
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 5.0u6,6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,solaris_10
  • CPU: generic,sparc
  • Submitted: 2006-02-06
  • Updated: 2011-01-27
  • Resolved: 2006-12-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
5.0u11 b02Fixed 6Fixed
Related Reports
Relates :  
Description
Hi,

the Hotspot crashes when a JVMTI agent tries to get all loaded classes
triggered by a thread stop event and that dying thread has an async
exception pending. You can reproduce the problem with the following
small program:

public class AsynchronousExceptionTest {
    public static void main(String[] args) {
        while (true) {
            final Thread t1 = new Thread(new Runnable() {
                public void run() {
                    try {
                        Thread.sleep((int) (Math.random() * 100));
                    } catch (InterruptedException e) {
                        // Ignore.
                    }

                    System.gc();
                }
            });

            Thread t2 = new Thread(new Runnable() {
                public void run() {
                    try {
                        Thread.sleep((int) (Math.random() * 100));
                        t1.stop();
                    } catch (InterruptedException e) {
                        // Ignore.
                    }
                }
            });

            t1.start();
            t2.start();

            try {
                t1.join();
                t2.join();
            } catch (InterruptedException e) {
                // Ignore.
            }
        }
    }
}

and starting the VM with the following commandline:
java -agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n AsynchronousExceptionTest

Comments
SUGGESTED FIX http://jpsesvr.sfbay.sun.com:8080/ctetools/html/ViewDetail.jsp?index=1981
06-12-2006

EVALUATION Hotspot crashes when a JVMTI agent tries to get all loaded classes triggered by a thread stop event and that dying thread has an Asynchronous (important!) exception pending. The Erorr occours because the ExceptionMark construcotr expects no pending Asynchronous exceptions. The proposed fix doesn't change the fact that pending exceptions are not allowed, but rather tries to handle this particular situation by modifying jvmtiEnv.cpp's JvmtiEnv::GetLoadedClasses as follows: 1) First Save the pending exception. 2) Clear it. 3) Call JvmtiGetLoadedClasses::getLoadedClasses 4) restore exception and return.
12-04-2006