You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression in steady_clock skew between pthreads #9783
I am measuring std::chrono::steady_clock on the main thread and on a pthread, with a clear happens-before relationship. So the time difference should always be non-negative.
Starting in release 1.39.0 (both upstream and fastcomp), I see negative time differences down to around -100ms.
I bisected the issue and found a5117d7 (Fix pthreads with closure compiler (#9569)) as the first "bad" commit.
(While bisecting, I noticed previous versions also sometimes have negative time differences, but the worst I found was -9ms. I guess it's difficult to guarantee steady clock synchronization between WASM pthreads and I can easily find a workaround for my use case. Reporting this just in case something has been overlooked in a5117d7. If not, feel free to close.)
Can you perhaps create a small testcase showing the issue? That would be much easier to debug, as reading the patch your bisection found, I'm not sure yet why it changed things.
Ok, I think I see what's going on here. That PR broke the __performance_now_clock_drift value, which before was a magic global, but after that PR we have no more such globals, and values must be passed around explicitly. Fix in #9799, please see if that helps your codebase.
Activity
kripken commentedon Nov 5, 2019
Thanks @niklasf !
Can you perhaps create a small testcase showing the issue? That would be much easier to debug, as reading the patch your bisection found, I'm not sure yet why it changed things.
niklasf commentedon Nov 7, 2019
Unfortunately I can't reproduce the regression in a minimal example. So there's probably not much that can be done.
The qualitative issue, i.e. small negative time differences, is easy to reproduce:
Compiler flags:
Script:
C++:
Sample output:
kripken commentedon Nov 7, 2019
Thanks for the testcase @niklasf !
Ok, I think I see what's going on here. That PR broke the
__performance_now_clock_driftvalue, which before was a magic global, but after that PR we have no more such globals, and values must be passed around explicitly. Fix in #9799, please see if that helps your codebase.Fix relative time in pthreads (emscripten-core#10137)