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

Synchronous GC not done with thread queue locked

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1beta2
    • CPU:
      sparc
    • OS:
      solaris_2.4
    • Verification:
      Not verified

      Backports

        Description

        Although it's locked during async GC, the thread queue is not locked during
        synchronous GC. This needs to be done because scanThreads() during GC needs
        the lock, and as that's done with scheduling locked we can't let there be any
        question that the GC-ing thread will get the lock. Not doing this causes a
        presumably rare race condition, but one that would be quite disasterous if it
        happens. In the race scenario, some other thread is holding the queue lock,
        say because it is creating another thread or enumerating threads. It gets
        scheduled out, and a thread that runs while it is out does a synchronous GC.
        With the scheduler locked the GC-ing thread tries to get the queue lock which
        is owned by the first thread. Green threads scheduling says that rather than
        deadlock, we quietly let another thread run. This could cause GC to have an
        inconsistent picture of the world, so it could break things in mysterious ways.

        It's not known with certainty that this scenario can actually happen, and if it
        can it can't be frequent. Given the easy fix it is a clearly unacceptable risk.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  tlindholsunw Timothy Lindholm (Inactive)
                  Reporter:
                  tlindholsunw Timothy Lindholm (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: