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

Assert when recursively trying to take the monitor from JVMTI MonitorContendedEnter

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: hs25, 8, 9
    • Fix Version/s: 15
    • Component/s: hotspot
    • Labels:
      None

      Description

      (This was seen when trying to reproduce a crash with the netbeans profiler: https://netbeans.org/bugzilla/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?

        Attachments

        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

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated: