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

Assert when recursively trying to take the monitor from JVMTI MonitorContendedEnter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • hs25, 8, 9
    • hotspot
    • None

      (This was seen when trying to reproduce a crash with the netbeans profiler: https://bz.apache.org/netbeans/show_bug.cgi?id=240763 )

      If one writes a JVMTI agent that listens for MonitorContendedEnter, and from that callback tries to take the same lock again, the JVM will assert on objectMonitor.cpp:348: assert (Self->_Stalled == 0, "invariant")

      This is the same problem as described in JDK-7184993 which was closed as a dup of the no-permgen enhancement. The problem is pretty well described in that bug in this comment https://bugs.openjdk.java.net/browse/JDK-7184993?focusedCommentId=12584932&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12584932

      The first question is: Is this valid code? Is it ok for a JVMTI agent to try to acquire locks in MonitorContendedEnter?

      Second question: If so, how do we make it possible?

        1. hs_err_pid43821.log
          49 kB
        2. hs_err_pid45258.log
          28 kB
        3. rec.c
          2 kB
        4. Recursive.java
          0.7 kB

            sspitsyn Serguei Spitsyn
            sla Staffan Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: