JDK-6402537 : LockSupport.park with large timeout overflows, causing immediate return, resulting in busy-poll loop
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris
  • CPU: generic
  • Submitted: 2006-03-23
  • Updated: 2012-10-08
  • Resolved: 2006-04-26
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 6
6 b82Fixed
Related Reports
Relates :  
Description
If a very long timeout is passed to a blocking method (such as java.util.concurrent.LinkedBlockingQueue.poll) that ultimately uses LockSupport.park, the park call returns immediately instead of suspending the thread. Because park is allowed to return spuriously, the calling code always loops checking the condition it was waiting for and recalling park. This results in a busy-wait loop as the method constantly recalls park, which keeps returning immediately.

Comments
WORK AROUND Use realistic timeout values. (The raw overflow only occurs for timeouts > 31.8 years)
23-03-2006

EVALUATION On Solaris and Linux the low-level park code transforms a timeout into an absolute time for use with the platform specific timed-wait mechanism. Some platform mechanisms have limits to the lengths of time they can wait, partly due to the use of 32-bit signed values. If the requested timeout results in an overflow then the resulting time is in the past and the platform mechanism returns immediately reporting the ETIME status. If a higher-level operation, like a Condition.await, sees the immediate return but finds neither the condition is satisfied nor the timeout elapsed, then it will re-park. The re-park again returns immediately and we get a busy-poll loop.
23-03-2006

SUGGESTED FIX Check for overflow and limit the time to the maximum supported.
23-03-2006