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

SA fails to properly attach to JVM after having just detached from a different JVM

    XMLWordPrintable

Details

    • b12

    Backports

      Description

        I noticed issues with both the HSDB GUI and clhsdb when attaching to a JVM, detaching, and then attaching to a different JVM (does not happening when reattaching to the same JVM). After the 2nd attach SA seems to be in a bad state which results in exceptions when issueing some commands. Specifically, instantiating a SA Klass wrapper fails. Here's one example:

        $ build/linux-x64-debug/images/jdk/bin/jhsdb clhsdb
        hsdb> attach 24845
        Attaching to process 24845, please wait...
        hsdb> jstack
        <jstack output>
        hsdb> detach
        hsdb> attach 26842
        Attaching to process 26842, please wait...
        hsdb> jstack
        WARNING: could not get Thread object: (7fa89c28aae0) sun.jvm.hotspot.types.WrongTypeException: No suitable match for type of address 0x00007fa7ff0478c8
        sun.jvm.hotspot.types.WrongTypeException: No suitable match for type of address 0x00007fa7ff3acea0
        at jdk.hotspot.agent/sun.jvm.hotspot.runtime.InstanceConstructor.newWrongTypeException(InstanceConstructor.java:62)
        at jdk.hotspot.agent/sun.jvm.hotspot.runtime.VirtualBaseConstructor.instantiateWrapperFor(VirtualBaseConstructor.java:111)
        at jdk.hotspot.agent/sun.jvm.hotspot.oops.Metadata.instantiateWrapperFor(Metadata.java:78)
        at jdk.hotspot.agent/sun.jvm.hotspot.oops.MetadataField.getValue(MetadataField.java:43)
        at jdk.hotspot.agent/sun.jvm.hotspot.oops.MetadataField.getValue(MetadataField.java:40)
        at jdk.hotspot.agent/sun.jvm.hotspot.oops.Klass.getNextLinkKlass(Klass.java:125)
        at jdk.hotspot.agent/sun.jvm.hotspot.classfile.ClassLoaderData.find(ClassLoaderData.java:86)
        at jdk.hotspot.agent/sun.jvm.hotspot.classfile.ClassLoaderDataGraph.find(ClassLoaderDataGraph.java:61)
        at jdk.hotspot.agent/sun.jvm.hotspot.memory.SystemDictionary.getAbstractOwnableSynchronizerKlass(SystemDictionary.java:115)
        at jdk.hotspot.agent/sun.jvm.hotspot.runtime.DeadlockDetector.print(DeadlockDetector.java:82)
        at jdk.hotspot.agent/sun.jvm.hotspot.runtime.DeadlockDetector.print(DeadlockDetector.java:39)
        at jdk.hotspot.agent/sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:62)
        at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor$27.doit(CommandProcessor.java:1153)
        at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:2212)
        at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:2182)
        at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.run(CommandProcessor.java:2053)
        at jdk.hotspot.agent/sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:112)
        at jdk.hotspot.agent/sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:44)
        at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runCLHSDB(SALauncher.java:281)
        at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:500)
        Can't print deadlocks: sun.jvm.hotspot.types.WrongTypeException: No suitable match for type of address 0x00007fa7ff3acea0
        Error: sun.jvm.hotspot.types.WrongTypeException: No suitable match for type of address 0x00007fa7ff3acea0

        I don't think it has anything to do with the ClassLoaderDataGraph or Klass.getNextLinkKlass(), since there are other exception stacks that don't include them. For example, in HSDB if you do the same attach/detach/attach sequence, you run into the following when Swing sends an update request to the Threads List window:

        Exception in thread "AWT-EventQueue-0" sun.jvm.hotspot.types.WrongTypeException: No suitable match for type of address 0x00007f9827010220
        at jdk.hotspot.agent/sun.jvm.hotspot.runtime.InstanceConstructor.newWrongTypeException(InstanceConstructor.java:62)
        at jdk.hotspot.agent/sun.jvm.hotspot.runtime.VirtualBaseConstructor.instantiateWrapperFor(VirtualBaseConstructor.java:111)
        at jdk.hotspot.agent/sun.jvm.hotspot.oops.Metadata.instantiateWrapperFor(Metadata.java:78)
        at jdk.hotspot.agent/sun.jvm.hotspot.oops.Oop.getKlassForOopHandle(Oop.java:210)
        at jdk.hotspot.agent/sun.jvm.hotspot.oops.ObjectHeap.newOop(ObjectHeap.java:181)
        at jdk.hotspot.agent/sun.jvm.hotspot.oops.NarrowOopField.getValue(NarrowOopField.java:44)
        at jdk.hotspot.agent/sun.jvm.hotspot.oops.OopUtilities.threadOopGetName(OopUtilities.java:199)
        at jdk.hotspot.agent/sun.jvm.hotspot.runtime.JavaThread.getThreadName(JavaThread.java:376)
        at jdk.hotspot.agent/sun.jvm.hotspot.ui.JavaThreadsPanel$CachedThread.compute(JavaThreadsPanel.java:381)
        at jdk.hotspot.agent/sun.jvm.hotspot.ui.JavaThreadsPanel$CachedThread.getThreadID(JavaThreadsPanel.java:363)
        at jdk.hotspot.agent/sun.jvm.hotspot.ui.JavaThreadsPanel$JavaThreadsTableModel.getValueAt(JavaThreadsPanel.java:292)
        at java.desktop/javax.swing.JTable.getValueAt(JTable.java:2769)
        <snip>

        Attachments

          Issue Links

            Activity

              People

                cjplummer Chris Plummer
                cjplummer Chris Plummer
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: