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

JDWP getLocks() should make sure current thread doesn't grab any more locks

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • 25
    • 23
    • core-svc
    • None

      In the debug agent threadControl module there is an API called getLocks() that grabs any monitor that may be needed during thread suspension, and then releaseLocks() releases them once thread suspension is done. This is to make sure we don't end up suspending a thread that is holding a monitor that we will need later on. A failure to grab all needed monitors can lead to a deadlock.

      Once the monitors are grabbed, we should store the current thread in a global and then assert that no more monitors are grabbed by that thread. This would just require debugMonitorEnter() comparing the global to the current thread. It does however need to allow re-entering already held monitors, which requires tracking entry counts for each monitor. This is being added by JDK-8328866 and can be leveraged once it is in place.

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

              Created:
              Updated: