JDK-6763959 : java.util.concurrent.locks.LockSupport.parkUntil(0) blocks forever instead of returning immediately
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 5.0,7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 2008-10-27
  • Updated: 2012-10-08
  • Resolved: 2010-11-12
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 JDK 7 Other
6u25Fixed 7Fixed hs20Fixed
Description
java.util.concurrent.locks.LockSupport.parkUntil takes an absolute timeout value which is relative to the epoch. So a value of zero is a time in the past and so parkUntil(0) should return immediately. What happens instead is that parkUntil(0) never times out.

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/build/hotspot/rev/1c352af0135d
04-12-2010

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/1c352af0135d
06-10-2010

EVALUATION In the low-level Parker::park(bool isAbsolute, jlong time) code the zero time case is being caught in the relative-time processing case instead of the absolute-time case. There are simple fixes: solaris/linux: (os_solaris.cpp:5736, os_linux.cpp:4579) if (time < 0) { // don't wait at all return; } becomes if (time < 0 || (isAbsolute && time==0) ) { // don't wait at all return; } On Windows: (os_windows.cpp:3901) if (time < 0) { // don't wait return; } else if (time == 0) { time = INFINITE; } else if (isAbsolute) { time -= os::javaTimeMillis(); // convert to relative time if (time <= 0) // already elapsed return; } becomes if (time < 0) { // don't wait return; } ! else if (time == 0 && !isAbsolute) { time = INFINITE; } else if (isAbsolute) { time -= os::javaTimeMillis(); // convert to relative time if (time <= 0) // already elapsed return; }
27-10-2008