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

Shenandoah: Fix racy GC request handling

XMLWordPrintable

    • gc
    • b33
    • generic
    • generic

        There are a number of related problems in how explicit and implicic GC requests are handled, which can lead to a thread not waiting for the requested GC cycle not finishing.

        First, observe that the gc_id in the control-thread is incremented concurrently.
        1. If the initial read of gc_id and the subsequent read at the beginning of the loop crosses that concurrent increment, then it will skip the whole loop and thus not wait as it should
        2. Even if we incremented the ID only at safepoints, it would be problematic, because both lock-acquisition and wait can cross a safepoint.

        The accesses of GC ID can be reshuffled to be safe. We migth also consider to update the ID at the initial safepoint, but it does not seem necessary.

              rkennke Roman Kennke
              rkennke Roman Kennke
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: