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

Assess and remedy any unsafe usage of the sr_semaphore Semaphore in the Posix signal code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 26
    • 8
    • hotspot
    • master

      As discussed in JDK-8361462, static Semaphores are potentially unsafe if accessed during VM termination. The suspend/resume code (for event sampling) in signals_posix.cpp declares:

      // suspend/resume support
      #if defined(__APPLE__)
        static OSXSemaphore sr_semaphore;
      #else
        static PosixSemaphore sr_semaphore;
      #endif

      It is very difficult to establish with certainty that we could not be utilising this semaphore around VM termination, so it is safest to fix the problem. The signal code already has another lazily initialization `Semaphore*` so we can easily change the `sr_semaphore` as well.

            dholmes David Holmes
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: