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

Make ResourceAreas reentrant-safe

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 25
    • hotspot

      I think we could make ResourceArea handling re-entrant-safe.

      The problem is that interrupting RA chunk allocation at the wrong moment will cause the RA to be inconsistent. Then, allocating a new RA chunk in the code invoked by the signal handler may crash the JVM.

      The problem is one of the reentrancy problem with the current "CPU Time Profiling for JFR" Draft JEP (https://bugs.openjdk.org/browse/JDK-8337789). And I believe that its one of the pressing problems. Here, threads would be interrupted at arbitrary points in their life, and the current approach is to walk the stack within these threads. Another user of similar techniques is the async profiler. But we also have this problem during normal hs-err reporting, where some reporting functions may use RA somewhere down their stack.

      Sometimes use cannot be avoided or happens accidentally.

      A simple way to deal with that would be to open a new RA inside the signal handler and pop that new RA when leaving the signal handler. If we do this operation atomically, this should be reentry-safe.


            stuefe Thomas Stuefe
            stuefe Thomas Stuefe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: