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.
9ff4ad7c2fd1fc0fce18cb59f5649658?d=identicon&s=25 Peter K Chan (Guest)
on 2009-01-14 18: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
22db9ef38f6c2301ef7fd667f18874d2?d=identicon&s=25 Tom E Purl (Guest)
on 2009-01-14 19: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
9ff4ad7c2fd1fc0fce18cb59f5649658?d=identicon&s=25 Peter K Chan (Guest)
on 2009-01-14 20: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:tep2@ntrs.com]
Sent: Wednesday, January 14, 2009 12:20 PM
To: user@jruby.codehaus.org
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
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-01-14 21: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
2b4e5507d94dc84a187d35c2884c0f3d?d=identicon&s=25 Christian Seiler (Guest)
on 2009-01-14 21: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
Ba2f834cba243e6d678c06626d544918?d=identicon&s=25 Vladimir Sizikov (Guest)
on 2009-01-14 21: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 Seiler <chr.seiler@gmail.com>
wrote:
>> is 6.0.4. System clock appears to be accurate after suspension; even the
>> From: Tom E Purl [mailto:tep2@ntrs.com] 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
9ff4ad7c2fd1fc0fce18cb59f5649658?d=identicon&s=25 Peter K Chan (Guest)
on 2009-01-14 21: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
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-01-14 21: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
9ff4ad7c2fd1fc0fce18cb59f5649658?d=identicon&s=25 Peter K Chan (Guest)
on 2009-01-15 00:30
(Received via mailing list)
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-05-13 09: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 Trindade wrote:
> Ricardo Trindade
>> 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
9d7ceca3c2fd90d61c6ea950f42b3a9a?d=identicon&s=25 marc (Guest)
on 2009-05-13 15:49
(Received via mailing list)
Ricardo Trindade 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:Charles.O.Nutter@sun.com">mailto:Charles.O.Nutter@sun.com</
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:part1.04040208.01060808@emation.pt" 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.