Forum: JRuby JRuby time offset wrong after VMware suspension

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Peter K Chan (Guest)
on 2009-01-14 19:12
(Received via mailing list)
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
Tom E Purl (Guest)
on 2009-01-14 20:22
(Received via mailing list)
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
Peter K Chan (Guest)
on 2009-01-14 21:57
(Received via mailing list)
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
Charles Oliver N. (Guest)
on 2009-01-14 22:10
(Received via mailing list)
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
Christian S. (Guest)
on 2009-01-14 22:18
(Received via mailing list)
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
Vladimir S. (Guest)
on 2009-01-14 22:25
(Received via mailing list)
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
Peter K Chan (Guest)
on 2009-01-14 22:26
(Received via mailing list)
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
Charles Oliver N. (Guest)
on 2009-01-14 22:43
(Received via mailing list)
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
Peter K Chan (Guest)
on 2009-01-15 01:30
(Received via mailing list)
Charles Oliver N. (Guest)
on 2009-05-13 11:58
(Received via mailing list)
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
marc (Guest)
on 2009-05-13 17:49
(Received via mailing list)
Ricardo T. said:

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

> <br>
>   <br>
>     <br>
>       <br>
> <a class="moz-txt-link-freetext"
> href="http://jira.codehaus.org/browse/JRUBY-3304">http://
jira.codehaus.org/browse/JRUBY-3304</a>
> 
href="mailto:removed_email_address@domain.invalid">mailto:removed_email_address@domain.invalid</
a>]
>       <br>
> something to do with it?
>       <br>
> To unsubscribe from this list, please visit:
>       <br>
>       <br>
> &nbsp;&nbsp;&nbsp; <a class="moz-txt-link-freetext"
> href="http://xircles.codehaus.org/manage_email">http://
xircles.codehaus.org/manage_email</a>
> &nbsp;&nbsp;&nbsp; <a class="moz-txt-link-freetext"
> href="http://xircles.codehaus.org/manage_email">http://
xircles.codehaus.org/manage_email</a>
> ---------------------------------------------------------------------
>   <br>
> To unsubscribe from this list, please visit:
>   <br>
>   <br>
> &nbsp;&nbsp; <a class="moz-txt-link-freetext"
> href="http://xircles.codehaus.org/manage_email">http://
xircles.codehaus.org/manage_email</a>
>   <br>
>   <br>
>   <br>
>   <br>
> </blockquote>
> <br>
> <div class="moz-signature">-- <br>
> <img src="cid:removed_email_address@domain.invalid" border="0"></div>
> </body>
> </html>





--
Best,
Marc


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
This topic is locked and can not be replied to.