JRuby time offset wrong after VMware suspension


#1

I noticed something interesting when I suspended a VMWare virtual
machine
running an active JRuby program. It seems like JRuby is not aware of
time
change during suspension:

Before suspension:
java.util.Date.new.to_s
=> Wed Jan 14 10:54:45 CST 2009

Time.now.to_s
=> Wed Jan 14 10:54:38 -0600 2009

After suspension for a few minutes:
java.util.Date.new.to_s
=> Wed Jan 14 10:58:20 CST 2009

Time.now.to_s
=> Wed Jan 14 10:54:52 -0600 2009

So far, I can replicate this bug with suspension in VMware, but not when
suspending a Windows or a mac.

Peter


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#2

Which guest OS are you using? What version of VMWare are you using? Is
the system clock accurate after suspension? Are you using dual-core
hardware?

Thanks,

Tom Purl


#3

Sorry to have omitted some of the details.

The guest OS is running Windows XP SP2 with JVM 1.6.0u7. The version of
VMware
is 6.0.4. System clock appears to be accurate after suspension; even the
JVM’s
clock is accurate (as evident by java.util.Date.new). It’s just that
JRuby
seems to track the time offset separate and lose track of the lost time
in
suspension (Time.now.to_s).

The host has a dual core processor, but the VM is configured with only
one
core.

Peter

From: Tom E Purl [mailto:removed_email_address@domain.invalid]
Sent: Wednesday, January 14, 2009 12:20 PM
To: removed_email_address@domain.invalid
Subject: Re: [jruby-user] JRuby time offset wrong after VMware
suspension

Which guest OS are you using? What version of VMWare are you using? Is
the
system clock accurate after suspension? Are you using dual-core
hardware?

Thanks,

Tom Purl


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#4

Peter K Chan wrote:

After suspension for a few minutes:
java.util.Date.new.to_s
=> Wed Jan 14 10:58:20 CST 2009

Time.now.to_s
=> Wed Jan 14 10:54:52 -0600 2009

So far, I can replicate this bug with suspension in VMware, but not when
suspending a Windows or a mac.

Super weird! I have no theories at the moment…

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#5

I think, I have a theory. We have an interesting way to calculate
current time in JRuby, trying to use both currentTimeMillis() and
nanoTime(). We use nanoTime in order to provide high-precision
timings, but nanoTime() is not real time, it can only increase and
doesn’t directly correspond to particular time moment.

So, we first get currentTimeMillis() and then just adding nanoTime()
increment to original values.

I guess, during suspend the nanoTime() values are not changing
(while physical time still passes), hence the weird behavior.

We also have a JIRA issue to replace current time calculation scheme
with something better, probably using some native support to obtain
high-resolution timing.

Thanks,
–Vladimir

On Wed, Jan 14, 2009 at 9:17 PM, Christian S. removed_email_address@domain.invalid
wrote:

is 6.0.4. System clock appears to be accurate after suspension; even the
From: Tom E Purl [mailto:removed_email_address@domain.invalid] Sent: Wednesday, January 14, 2009


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#6

I have had reports of time offset issue for a very long time, but was
never able to replicate it until I used VMware.

I remember previously looking into the JRuby source code and seeing some
kind of custom tracking using the JVM nanoTime. Perhaps that has
something to do with it?

I assume that I should file a bug for this?

Peter


#7

Peter K Chan wrote:

I have had reports of time offset issue for a very long time, but was never able to replicate it until I used VMware.

I remember previously looking into the JRuby source code and seeing some kind of custom tracking using the JVM nanoTime. Perhaps that has something to do with it?

I assume that I should file a bug for this?

Yes please!


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#8

I have the same thing happening with my regular laptop (Ubuntu 8.10).
When I suspend and resume the computer Time.now reports values like time
hasn’t moved on

Peter K Chan wrote:


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#9

I commented on the bug, but the nanoTime code was removed some time ago
to fix this problem. Did you see it in production with 1.1.6 or 1.2?

  • Charlie

Ricardo T. wrote:

Ricardo T.

Sent: Wednesday, January 14, 2009 2:42 PM


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#10

Done.

http://jira.codehaus.org/browse/JRUBY-3304

Peter


#11

Ricardo T. said:

Could you switch off html, please. I can’t follow this.









http://
jira.codehaus.org/browse/JRUBY-3304

href=“mailto:removed_email_address@domain.invalid”>mailto:removed_email_address@domain.invalid</
a>]


something to do with it?


To unsubscribe from this list, please visit:




    http://
xircles.codehaus.org/manage_email

    http://
xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

   http://

xircles.codehaus.org/manage_email






--


Best,
Marc


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email