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

Unhanded oop detector code causes oops in debugging statements to be wrong

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 6
    • hotspot
    • b93
    • generic
    • generic

      Quoted text from email:

      "I just ran across a problem during debugging which Tom had run into
      and which people should be aware of. Due to the presence of the new
      unchecked oop code, where "oop" is not the same as "oopDesc*", it is
      likely that a significant amount of the printing code in the JVM is
      broken. I saw a thread dump looking something like this: (this has
      been fabricated to illustrate the problem, I don't have the original
      around right now)

      "AWT-EventQueue-0" prio=10 tid=0x002e4c00 nid=0x12 runnable [0xd557e000..0xd557fb10]
          java.lang.Thread.State: RUNNABLE
          JavaThread state: _thread_blocked
      Thread: 0x002e4c00 [0x12] State: _call_back _has_called_back 1 _at_poll_safepoint 0
          JavaThread state: _thread_blocked
               at java.awt.MediaEntry.getStatus(MediaTracker.java:853)
               - locked <0xd557e500> (a java.awt.ImageMediaEntry)
               at java.awt.ImageMediaEntry.getStatus(MediaTracker.java:902)
               at java.awt.MediaTracker.statusID(MediaTracker.java:689)
               - locked <0xd557e500> (a java.awt.MediaTracker)
               at java.awt.MediaTracker.waitForID(MediaTracker.java:637)
               - locked <0xd557e500> (a java.awt.MediaTracker)
               at javax.swing.ImageIcon.loadImage(ImageIcon.java:234)
               - locked <0xd557e500> (a java.awt.MediaTracker)
               at javax.swing.ImageIcon.<init>(ImageIcon.java:125)
               at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
      ...

      Note that it looks like the same object has been locked multiple times
      and that it is reported as a java.awt.MediaTracker in one situation
      and as a java.awt.ImageMediaEntry in another. In reality they are
      different objects, but the code in vframe.hpp which prints this code
      isn't printing the actual oop in debug or fastdebug builds, but the
      address of the stack slot used for the unhandled oop checking:

      static void print_locked_object_class_name(outputStream* st,
                                                  Handle obj,
                                                  const char* lock_state) {
         if (obj.not_null()) {
           st->print("\t- %s <" INTPTR_FORMAT "> ", lock_state, obj());
         ...

      I can imagine that most of the debugging printing code is affected in
      a similar way. Due to the fact that printf is untyped there doesn't
      appear to be any way to fix this problem other than finding and fixing
      all of the affected printing code, i.e., by adding an explicit cast to
      oopDesc*. For the time being I worked around it by disabling the
      unhandled oop checking in my workspace's Makefiles
      (build/solaris/makefiles/{jvmg,fastdebug}.make).

      -Ken"

      Actually, I thought the compiler disallowed non-POD objects from being passed into varargs so I'm not entirely sure of the extent of the problem, but this text provides examples that should be fixed.
      <deleted text from other bug>

            coleenp Coleen Phillimore
            coleenp Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: