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

[REDO] G1DirtyCardQueue destructor has useless flush

XMLWordPrintable

    • gc
    • b25

       ~G1DirtyCardQueue calls flush(), but that's too late. The final flush must occur in on_thread_detach(), with no further queued log entries after that, else operations like concatenate_logs won't be able to find and process those late logs. on_thread_detach() already contains the necessary flush(), so the one in the destructor is just a waste of time, and possibly hides bugs. Better to just remove it.

      However, it's not so simple as just removing the call (and possibly the now empty destructor). There are bootstrapping problems (see JDK-8240722). There are write barrier invocations by the initial thread before it has been added to the threads list (which includes calling BarrierSet::on_thread_attach). Those are occurring in init_globals. If init_globals ultimately returns failure, the initial thread gets deleted, without calling BarrierSet::on_thread_detach (where the flush would normally occur for a running thread being deleted). This leaves a partially filled buffer in place, triggering the assert in ~PtrQueue.

            kbarrett Kim Barrett
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: