Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8308507 G1: GClocker induced GCs can starve threads requiring memory leading to OOME
  3. JDK-8309349

Release Note: GCLocker Induced Garbage Collections No Longer Starve Mutator Threads in G1

XMLWordPrintable

    • gc

      Previously, application threads waiting for memory while the heap is locked by GCLocker may be starved from receiving memory by unfortunate thread scheduling. This can cause unnecessary Out-Of-Memory exceptions in the affected threads.

      This problem is as follows:

      1. Thread A tries to allocate memory as normal, starting a garbage collection. Since GCLocker is active, the thread gets stalled waiting for the garbage collection.
      2. The garbage collection pause induced by GCLocker executes and frees some memory.
      3. Due to thread scheduling, thread A does not get any of that memory, only other threads also requesting memory at the same time.
      4. Steps 1-3 repeat until the retry count threshold has been reached, causing thread A to throw an Out Of Memory exception.

      Now, the garbage collection pause in step 2 above tries to satisfy all pending threads' memory requests at once, which completely avoids this situation.

      At this time, only G1 has this enhancement. Other collectors may still be prone to this issue.

            iwalulya Ivan Walulya
            tschatzl Thomas Schatzl
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: