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

Threads::number_of_threads() is not 'MT-safe'

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 10
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:

      Description

      Threads::number_of_threads() is a plain _int_ but accessed sometimes like it was an atomic that never can go back to zero. Some use-cases are certainly suspicious and we must investigate if they can handle the raciness of this method. If you have Threads_lock this method behaves as intended, except it can go back to zero before VM has finished exiting. Which makes a check against zero also mean we are exiting.

      Most of the use cases wants to know if we have 'booted' and the other should probably use a (SMR) ThreadsList. So I suggest removing this method and create a new method for 'have VM booted'.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rehn Robbin Ehn
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: