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

Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler

XMLWordPrintable

    • b04
    • generic, sparc
    • solaris, solaris_9

      On Solaris Thread.interrupt both sets the interrupted flag of the thread and raises a signal via thr_kill. A Thread.sleep checks the interrupt status then perform a timed-poll relying on a signal to cancel the poll and return EINTR. However, there is a race such that we can have:

            Interrupting thread Target Thread
      ---------------------------------------------------------------
                                               check interrupt flag
            set interupt flag
            thr_kill
                                                <signal delivered>
                                                poll(ms)

      The signal is delivered before the poll() and so the "sleep" continues until the specified time elapses.

            fparain Frederic Parain
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: