<div dir="ltr">Hi, Eric<div><br></div><div>Let&#39;s consider a very simple case in Java world:</div><div><br></div><div>```</div><div>Thread.sleep(1);</div><div>```</div><div><br></div><div>The sleep method may be trapped If the restore machine has a smaller boot time, the method returned after twenty minutes in my two machines. Moreover, the blocking method with a timeout, the schedule thread pool also won&#39;t work as expected.</div><div><br></div><div>Regards,</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 2, 2018 at 2:46 PM, Andrei Vagin <span dir="ltr">&lt;<a href="mailto:avagin@virtuozzo.com" target="_blank">avagin@virtuozzo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Jun 01, 2018 at 10:12:03PM -0500, Eric W. Biederman wrote:<br>
&gt; Andrei Vagin &lt;<a href="mailto:avagin@virtuozzo.com">avagin@virtuozzo.com</a>&gt; writes:<br>
&gt; <br>
&gt; &gt; On Fri, Jun 01, 2018 at 01:20:33PM -0500, Eric W. Biederman wrote:<br>
&gt; &gt;&gt; Adrian Reber &lt;<a href="mailto:adrian@lisas.de">adrian@lisas.de</a>&gt; writes:<br>
&gt; &gt;&gt; <br>
&gt; &gt;&gt; &gt; On Fri, Jun 01, 2018 at 11:04:26AM +0800, yukon wrote:<br>
&gt; &gt;&gt; &gt;&gt; I found that the criu community intent to resolve the timer issue[1], I<br>
&gt; &gt;&gt; &gt;&gt; wonder if there is an issue to<br>
&gt; &gt;&gt; &gt;&gt; track the progress?<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; I have heard of other people experimenting with it and I also had a few<br>
&gt; &gt;&gt; &gt; patches to try it out. The point where I stopped is when I found out<br>
&gt; &gt;&gt; &gt; that most time calls are actually coming from the VDSO and not from the<br>
&gt; &gt;&gt; &gt; kernel and it is still unclear to me how to handle namespaces and VDSO<br>
&gt; &gt;&gt; &gt; correctly.<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; I have also talked with Christian (on CC) about it and I also contacted<br>
&gt; &gt;&gt; &gt; Eric at some point (also on CC). Maybe they have more information about<br>
&gt; &gt;&gt; &gt; the current status.<br>
&gt; &gt;&gt; <br>
&gt; &gt;&gt; Andriae.  My apologies for not getting back to you earlier (I was<br>
&gt; &gt;&gt; swamped) but that is not a good excuse.  I was very impressed by what<br>
&gt; &gt;&gt; you did.<br>
&gt; &gt;&gt; <br>
&gt; &gt;&gt; For me personally I have been looking for a real world case where the<br>
&gt; &gt;&gt; timers matter.  Having that would increase the priority of this work<br>
&gt; &gt;&gt; from where I stand.<br>
&gt; &gt;&gt; <br>
&gt; &gt;&gt; To date all I have done is recognize that a time namespace is almost<br>
&gt; &gt;&gt; certainly something that we need, and read the code enough to have a<br>
&gt; &gt;&gt; general sense of how the time infrastructure in the kernel works.<br>
&gt; &gt;&gt; <br>
&gt; &gt;&gt; I think the VDSO has per cpu if not per process constants so we should<br>
&gt; &gt;&gt; be able to affect this in a namespace.  If the VDSO does not we<br>
&gt; &gt;&gt; certainly can make that happen.<br>
&gt; &gt;&gt; <br>
&gt; &gt;&gt; I would be very happy to merge a time namespace.   I would probably even<br>
&gt; &gt;&gt; start looking at implementation details if I had a compelling test case<br>
&gt; &gt;&gt; in my hand.<br>
&gt; &gt;&gt; <br>
&gt; &gt;&gt; Yukon.  I don&#39;t have the beginning of this thread.  So if you know of a<br>
&gt; &gt;&gt; practical case that does not work because of timers I would love to hear<br>
&gt; &gt;&gt; about it.<br>
&gt; &gt;<br>
&gt; &gt; Hi Eric,<br>
&gt; &gt;<br>
&gt; &gt; We have a practial case. A few CRIU users reported us situations, when<br>
&gt; &gt; applications stop working after migrating them to another host.<br>
&gt; &gt;<br>
&gt; &gt; Usually this means that they use clock_gettime or timer_settime. The<br>
&gt; &gt; problem here is that we can&#39;t adjust clocks on a destination host to<br>
&gt; &gt; their values on a source host. For example, the application uses<br>
&gt; &gt; CLOCK_MONOTONIC to measure time slices, but after migrating to another<br>
&gt; &gt; host, clock_gettime(CLOCK_MONOTONIC) may retun a value which is smaller<br>
&gt; &gt; than what was gotten on the source host. The application doesn&#39;t expect<br>
&gt; &gt; such behaviour for CLOCK_MONOTONIC, and it probably will work<br>
&gt; &gt; incorrectly (stuck, crash, etc).<br>
&gt; &gt;<br>
&gt; &gt; Here is one quote from the CRIU mailing list:<br>
&gt; &gt;<br>
&gt; &gt;   Is there a timeline on when the time namespace might be implemented? Or<br>
&gt; &gt;   else is there anyone, even outside CRIU, working on it that you guys<br>
&gt; &gt;   know of? It seems like this might be one of the last major obstacles<br>
&gt; &gt;   keeping migration from being used in production systems, given that not<br>
&gt; &gt;   all containers and connections can be migrated as long as a time<br>
&gt; &gt;   dependency is capable of messing it up.<br>
&gt; &gt;   <a href="https://github.com/checkpoint-restore/criu/issues/451#issuecomment-386073812" rel="noreferrer" target="_blank">https://github.com/checkpoint-<wbr>restore/criu/issues/451#<wbr>issuecomment-386073812</a><br>
&gt; <br>
&gt; <br>
&gt; Is there an open source application that is known to fail that way?<br>
<br>
</div></div>After a quick search in CRIU github issues, I found two projects:<br>
<br>
RabbitMQ aborted with the &quot; OS monotonic time stepped backwards<br>
Aborted&quot; error. <br>
<br>
<a href="https://github.com/checkpoint-restore/criu/issues/426" rel="noreferrer" target="_blank">https://github.com/checkpoint-<wbr>restore/criu/issues/426</a><br>
<br>
It looks like any program which is written in Erlang has this issue:<br>
<a href="https://github.com/erlang/otp/blob/master/erts/emulator/beam/erl_time_sup.c#L299" rel="noreferrer" target="_blank">https://github.com/erlang/otp/<wbr>blob/master/erts/emulator/<wbr>beam/erl_time_sup.c#L299</a><br>
<br>
OracleDB kills itself after C/R<br>
<br>
&quot;Once Oracle monitor process sees that the process start time changes, it<br>
takes a dagger out and makes seppuku.&quot;<br>
<br>
<a href="https://medium.com/@kolyshkin/oracle-in-a-docker-container-checkpoint-restore-debug-fun-dda98b7302ed" rel="noreferrer" target="_blank">https://medium.com/@kolyshkin/<wbr>oracle-in-a-docker-container-<wbr>checkpoint-restore-debug-fun-<wbr>dda98b7302ed</a><br>
<span class=""><br>
<br>
&gt; <br>
&gt; I completely believe the issue is real.  But it really helps to have<br>
&gt; motivating applications so that some corner case is not skipped.<br>
&gt; <br>
&gt; I will have to look at tcp timestamps, and see how those interact<br>
&gt; with the kernel&#39;s timers.  To see if that is a time namespace issue.<br>
<br>
</span>Each tcp socket has a timestamp offset, and criu sets it on restore.<br>
<br>
commit 93be6ce0e91b6a94783e012b1857a3<wbr>47a5e6e9f2<br>
Author: Andrey Vagin &lt;<a href="mailto:avagin@openvz.org">avagin@openvz.org</a>&gt;<br>
Date:   Mon Feb 11 05:50:18 2013 +0000<br>
<br>
    tcp: set and get per-socket timestamp<br>
<br>
    A timestamp can be set, only if a socket is in the repair mode.<br>
<br>
    This patch adds a new socket option TCP_TIMESTAMP, which allows to<br>
    get and set current tcp times stamp.<br>
<div class="HOEnZb"><div class="h5"><br>
&gt; <br>
&gt; Eric<br>
______________________________<wbr>_________________<br>
CRIU mailing list<br>
<a href="mailto:CRIU@openvz.org">CRIU@openvz.org</a><br>
<a href="https://lists.openvz.org/mailman/listinfo/criu" rel="noreferrer" target="_blank">https://lists.openvz.org/<wbr>mailman/listinfo/criu</a><br>
</div></div></blockquote></div><br></div>