-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python Threading Ticker needs FAKETIME_DONT_FAKE_MONOTONIC #390
Comments
Thanks for reporting and posting a workaround! Since you clone the repository and compile, have you checked whether "make test" also hangs in the container? If so, compiling with FORCE_MONOTONIC_FIX enabled in the Makefile might help. |
I also get this with just: from threading import Event
event = Event()
print("Waiting")
event.wait(1.0)
print("Done") I get this, hanging after "waiting":
gdb stacktrace:
See https://sources.debian.org/src/python3.10/3.10.4-3/Python/thread_pthread.h/#L488 I'm using libfaketime v0.9.10 and python 3.10.4 on Debian sid. Python 3.10.4 uses sem_clockwait which seems not implemented in libfaketime, I don't find it in https://github.com/wolfcw/libfaketime/blob/v0.9.10/src/libfaketime.c. Using |
I also get the hang with
With sem_clockwait with CLOCK_MONOTONIC, the glibc is calling the kernel directly with a monotonic clock, and as the kernel is expected something in the lines of Python 3.10 does this:
|
Thanks for your detailed analysis, all plausible. Let's hope it's related to the yet missing f706373 experimentally adds support for |
I will try the commit now. |
I've tested commit f706373 with And it doesn't hang, the delay is the expected one. doc@debian64:faketime$ time env FAKETIME="+200d x2" LD_PRELOAD=$PWD/libfaketime.so.1 python3.10 ~/test/test_sem_clockwait.py
Waiting
Done
real 0m2,127s
user 0m0,018s
sys 0m0,022s
doc@debian64:faketime$ time env FAKETIME="+200d x0.5" LD_PRELOAD=$PWD/libfaketime.so.1 python3.10 ~/test/test_sem_clockwait.py
Waiting
Done
real 0m0,527s
user 0m0,048s
sys 0m0,000s Compared to sleep: doc@debian64:faketime$ time FAKETIME="+200d x2" LD_PRELOAD=$PWD/libfaketime.so.1 sleep 1
real 0m0,505s
user 0m0,000s
sys 0m0,004s
doc@debian64:faketime$ time FAKETIME="+200d x0.5" LD_PRELOAD=$PWD/libfaketime.so.1 sleep 1
real 0m2,004s
user 0m0,001s
sys 0m0,003s So it doesn't hang anymore, but the clock speed feature is not totally ok. |
Thanks for testing and pointing this out! This latest commit should address the reversed factor. |
Good, I've not found any issues now with 859751e:
|
Hi, currently my initial test case does not work. leaving away FAKETIME_DONT_FAKE_MONOTONIC resolves this. |
Somehow this does also not work if
|
The latest commit should fix that the intercepted If the issue persists for you, does it happen no matter whether |
Great. That works great now. Empty faketime works too. I will close this issue as nothing else is left to do. |
I had the Problem that my background jobs did not execute in a docker container with mocked time through the great libfaketime library.
My MWE (minimum working example) to reproduce this issue looks like this:
This does not print anything.
Yet, if the environment variable
FAKETIME_DONT_FAKE_MONOTONIC=1
is set, it works.Exemplary Dockerfile:
This was an issue I struggled with, so I wanted to document it so that others can find the solution.
Maybe its worth noting that
FAKETIME_DONT_FAKE_MONOTONIC
is not only needed for JavaThe text was updated successfully, but these errors were encountered: