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

JDWP assumes that events are reported in the causing thread

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P2 P2
    • 6
    • 5.0
    • core-svc
    • 1.5
    • 5.0
    • b10
    • generic
    • generic

      We've run into a bit of a problem with the JDWP implementation
      in JDK 5.0. It would seem that this assumes (at least in debug
      asserts) that events in general, and more specific, breakpoint
      events reported through JVMTI, are reported through the same
      thread that causes them.

      The spec for JVMTI states that the breakpoint callback is called
      like:

        void JNICALL Breakpoint(jvmtiEnv *,JNIEnv*,jthread, jmethodID, location)

      where the parameters are defined as:

        JNIEnv * - The JNI environment of the event (current) thread
        jthread - Thread that hit the breakpoint
        jmethodID - Method that hit the breakpoint
        jlocation - location of the breakpoint

      Our intepretation of this is that the implementation is free to
      report a breakpoint through a separate thread, and that the agent
      should not assume to be run in the same thread as the breakpoint.

      The assertion I ran into is located at
      src/share/back/threadcontrol.c:1957

        1956 /* JNIEnv should always be the same for a given thread */
        1957 JDI_ASSERT(node->env == env);

      I can't see any reason in the event handling code of JDWP that would
      make this assumption neccesary, so I would very much appreciate a
      resolution that just removed it.

            ohair Kelly Ohair (Inactive)
            clucasius Carlos Lucasius (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: