JDK-6546236 : Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 5.0,6,7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris,solaris_9
  • CPU: generic,sparc
  • Submitted: 2007-04-16
  • Updated: 2014-06-26
  • Resolved: 2014-02-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b04Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
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.

Comments
SUGGESTED FIX Replace the platform dependent sleep routines with a platform independent one based on use of a ParkEvent. This will also allow addressing of "early return from sleep" problems.
16-04-2007

EVALUATION See description
16-04-2007