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

G1 log for active workers is wrong

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      gc

      Description

      The logging of number of workers used by the young GCs in G1 is wrong.

      The code looks like this:
      ---
          uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
                                                                        workers()->active_workers(),
                                                                        Threads::number_of_non_daemon_threads());
          workers()->update_active_workers(active_workers);
          log_info(gc,task)("Using %u workers of %u for evacuation", active_workers, workers()->total_workers());
      ---

      This looks ok, but if anything goes wrong in when updating the number of active workers the value might not be what is expected. This is easily triggered by using -XX:+UseDynamicNumberOfGCThreads -XX:+UnlockDiagnosticVMOptions -XX:+InjectGCWorkerCreationFailure.

      The fix is also simple, just print workers()->active_workers().

        Activity

        Hide
        sjohanss Stefan Johansson added a comment - - edited
        Log showing the issue:
        [8,600s][info ][gc,start ] GC(0) Pause Young (G1 Evacuation Pause)
        [8,600s][trace][gc,task ] GC(0) GCTaskManager::calc_default_active_workers() : active_workers(): 1 new_active_workers: 6 prev_active_workers: 1
         active_workers_by_JT: 2 active_workers_by_heap_size: 6
        [8,600s][trace][gc,task ] GC(0) WorkerManager::add_workers() : creation failed due to failed allocation of native memory
        [8,600s][trace][gc,task ] GC(0) WorkerManager::add_workers() : created_workers: 1
        [8,600s][trace][gc,task ] GC(0) GC Thread: using 1 out of 18 workers
        [8,600s][info ][gc,task ] GC(0) Using 6 workers of 18 for evacuation <----- wrong
        [8,601s][trace][gc,task ] GC(0) WorkerManager::add_workers() : created_workers: 1
        [8,601s][trace][gc,task ] GC(0) GC Thread: using 1 out of 18 workers
        [8,636s][trace][gc,task ] GC(0) WorkerManager::add_workers() : created_workers: 1
        Show
        sjohanss Stefan Johansson added a comment - - edited Log showing the issue: [8,600s][info ][gc,start ] GC(0) Pause Young (G1 Evacuation Pause) [8,600s][trace][gc,task ] GC(0) GCTaskManager::calc_default_active_workers() : active_workers(): 1 new_active_workers: 6 prev_active_workers: 1  active_workers_by_JT: 2 active_workers_by_heap_size: 6 [8,600s][trace][gc,task ] GC(0) WorkerManager::add_workers() : creation failed due to failed allocation of native memory [8,600s][trace][gc,task ] GC(0) WorkerManager::add_workers() : created_workers: 1 [8,600s][trace][gc,task ] GC(0) GC Thread: using 1 out of 18 workers [8,600s][info ][gc,task ] GC(0) Using 6 workers of 18 for evacuation <----- wrong [8,601s][trace][gc,task ] GC(0) WorkerManager::add_workers() : created_workers: 1 [8,601s][trace][gc,task ] GC(0) GC Thread: using 1 out of 18 workers [8,636s][trace][gc,task ] GC(0) WorkerManager::add_workers() : created_workers: 1

          People

          • Assignee:
            Unassigned
            Reporter:
            sjohanss Stefan Johansson
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: