Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6381526

Unexpected async exception in jvmti_GetLoadedClasses()

XMLWordPrintable

    • 5.0
    • b02
    • generic, sparc
    • generic, solaris_10

        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

              minqi Yumin Qi
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: