JDK-7049774 : UID construction appears to hang if time changed backwards
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.rmi
  • Affected Version: 6u24
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-05-30
  • Updated: 2014-11-19
  • Resolved: 2011-06-27
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 Availabitlity Release.

To download the current JDK release, click here.
JDK 6 JDK 7 JDK 8
6u26-rev b23Fixed 7u2Fixed 8Fixed
Description
SHORT SUMMARY: BUG IN UID CODE CAUSING RMI SERVER TO HANG IF SYSTEM TIME IS 
CHANGED BACKWARD

INDICATORS:

Server RMI clock changed backwards, RMI server will hang with following stack 
trace : 

@ "RMI TCP Connection(4770)-127.0.0.1" daemon prio=10 tid=0x80ef4400 
nid=0x5a27
@ waiting for monitor entry [0xf57ff000]
@    java.lang.Thread.State: BLOCKED (on object monitor)
@                 at java.rmi.server.UID.<init>(UID.java:93)
@                 - waiting to lock <0x5d56c090> (a java.lang.Object)
@                 at
@ 
sun.rmi.transport.ConnectionOutputStream.<init>(ConnectionOutputStream.java:47

@ )
@                 at
@ 
sun.rmi.transport.StreamRemoteCall.getOutputStream(StreamRemoteCall.java:83)
@                 at
@ 
sun.rmi.transport.StreamRemoteCall.getResultStream(StreamRemoteCall.java:171)
@                 at
@ sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:312)
@                 at sun.rmi.transport.Transport$1.run(Transport.java:159)
@                 at java.security.AccessController.doPrivileged(Native 
Method)
@                 at
@ sun.rmi.transport.Transport.serviceCall(Transport.java:155)
@                 at
@ sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
@                 at
@ 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:79

@ 0)
@                 at
@ 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649

@ )
@                 at
@ 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java

@ :886)
@                 at
@ 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908

@ )
@                at java.lang.Thread.run(Thread.java:662)
@ .


COUNTER INDICATORS:
TRIGGERS:

System clock changed back on an RMI server and 65536 UID
constructor calls made. 

KNOWN WORKAROUND:

Don't modify system clock while RMI server is running.

PRESENT SINCE:

Looks to be present since at least 1.4.2 + later JDK code.
HOW TO VERIFY:

Testcase available - (to upload/attach later)

NOTES FOR SE:

Reported on 6u24.
We should add an extra condition so that the lastCount static variable 
counter is checked against the current millisecond time value (i.e 65536
unique constructor calls allowed per millisecond) 

REGRESSION:

N/A

Comments
EVALUATION same port as jdk 8 fix. We no longer have to wait if system clock is gone back.
2011-06-20