Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6863420
Votes 0
Synopsis os::javaTimeNanos() go backward on Solaris x86
Category hotspot:runtime_system
Reported Against
Release Fixed hs16(b08), 6u18(b01) (Bug ID:2181931) , 7(b71) (Bug ID:2182189)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 6784100 , 6855228 , 6864214 , 6864866
Submit Date 23-JUL-2009
Description
I reproduced nanoTime() go backward on our systems (Shanghai, Harpertown, Nehalem) running solaris 10 and 11.
Compiled code calls the runtime method which claims that it can't go backward.

% /java/re/jdk/7/latest/binaries/solaris-i586/bin/java NanoTimer
Spawning 1 threads
Spawning 2 threads
Spawning 3 threads
Spawning 4 threads
Spawning 5 threads
Spawning 6 threads
Spawning 7 threads
Spawning 8 threads
Spawning 9 threads
Spawning 10 threads
Spawning 11 threads
Spawning 12 threads
Spawning 13 threads
Spawning 14 threads
Spawning 15 threads
Spawning 16 threads
Spawning 17 threads
Spawning 18 threads
Spawning 19 threads
Spawning 20 threads
Spawning 21 threads
Spawning 22 threads
Backwards: start=116810214972243 end=116806060017005 time= -4154955238
Backwards: start=116810154970260 end=116806090238787 time= -4064731473
Spawning 23 threads
Spawning 24 threads
Spawning 25 threads
Spawning 26 threads
Backwards: start=116814484972775 end=116810230014943 time= -4254957832
Backwards: start=116814504969926 end=116810250009178 time= -4254960748
Backwards: start=116814404975763 end=116810230016200 time= -4174959563
Backwards: start=116814484973480 end=116810270013273 time= -4214960207
Spawning 27 threads
Spawning 28 threads
Spawning 29 threads
Spawning 30 threads
Spawning 31 threads
Spawning 32 threads
Posted Date : 2009-07-23 01:23:44.0
Work Around
N/A
Evaluation
The problem is non atomic load from max_hrtime in getTimeNanos() on platforms where long is kept in 2 32-bit register.

     const hrtime_t prev = max_hrtime;

'prev' could be invalid (> current time) since registers are loaded separately and store could happened in between.
It could be returned as result:

    if (now <= prev)  return prev;   // same or retrograde time;

And if the next call getTimeNanos() returns the correct time it will be less then previous result.
Posted Date : 2009-07-23 23:25:06.0

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/665be97e8704
Posted Date : 2009-07-27 04:49:35.0

http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/665be97e8704
Posted Date : 2009-08-10 07:34:33.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang