<div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 9, 2020 at 11:39 AM Davide Italiano <<a href="mailto:ditaliano@apple.com">ditaliano@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><br>
<br>
> On Apr 9, 2020, at 11:05, Jonas Devlieghere via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br>
> <br>
> <br>
> Author: Jonas Devlieghere<br>
> Date: 2020-04-09T11:03:24-07:00<br>
> New Revision: 680082a408dd2df7410d77696100eac8ce9d5530<br>
> <br>
> URL: <a href="https://github.com/llvm/llvm-project/commit/680082a408dd2df7410d77696100eac8ce9d5530" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/680082a408dd2df7410d77696100eac8ce9d5530</a><br>
> DIFF: <a href="https://github.com/llvm/llvm-project/commit/680082a408dd2df7410d77696100eac8ce9d5530.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/680082a408dd2df7410d77696100eac8ce9d5530.diff</a><br>
> <br>
> LOG: [lldb/Reproducers] Add a small artificial delay before exiting<br>
> <br>
> Add a small artificial delay in replay mode before exiting to ensure<br>
> that all asynchronous events have completed. This should reduce the<br>
> level of replay flakiness on some of the slower bots.<br>
> <br>
> Added: <br>
> <br>
> <br>
> Modified: <br>
>    lldb/source/Utility/ReproducerInstrumentation.cpp<br>
> <br>
> Removed: <br>
> <br>
> <br>
> <br>
> ################################################################################<br>
> diff  --git a/lldb/source/Utility/ReproducerInstrumentation.cpp b/lldb/source/Utility/ReproducerInstrumentation.cpp<br>
> index 4c32d9407830..3bf81286bbe9 100644<br>
> --- a/lldb/source/Utility/ReproducerInstrumentation.cpp<br>
> +++ b/lldb/source/Utility/ReproducerInstrumentation.cpp<br>
> @@ -8,6 +8,7 @@<br>
> <br>
> #include "lldb/Utility/ReproducerInstrumentation.h"<br>
> #include "lldb/Utility/Reproducer.h"<br>
> +#include <thread><br>
> #include <stdio.h><br>
> #include <stdlib.h><br>
> <br>
> @@ -94,6 +95,10 @@ bool Registry::Replay(llvm::StringRef buffer) {<br>
>     GetReplayer(id)->operator()(deserializer);<br>
>   }<br>
> <br>
> +  // Add a small artificial delay to ensure that all asynchronous events have<br>
> +  // completed before we exit.<br>
> +  std::this_thread::sleep_for (std::chrono::milliseconds(100));<br>
> +<br>
>   return true;<br>
> }<br>
> <br>
<br>
I understand this is (unfortunately) sorely needed, but I’m somehow skeptical of random delays. <br>
You probably thought about this and dropped the idea on the floor — but, is there a way to make the sync more explicit?<br>
If you can’t, at least you can detect not everything is in order and sleep, for, e.g. another 100 milliseconds in a retry-loop?<br></blockquote><div><br></div><div>Yeah, it's a hack, and I'm not really happy with it. The last replayed API call can be literaly anything, so you don't know what you might have to wait for. I can't think of a good way to do the synchronization without breaking layering/abstractions. The issue on GreenDragon was that we exited before the stop event came in, and while we could probably synchronize that, it would be even more ad-hoc than this...  </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
—<br>
Davide</blockquote></div></div></div>