libfaketime icon indicating copy to clipboard operation
libfaketime copied to clipboard

Process is blocked when using file approach with the dotnet process

Open MWild67 opened this issue 10 months ago • 3 comments

We want to use the library in our test base on MSTest/ReqNRoll. We are starting the test by "dotnet test <OurTest.dll>" in containers running linux and during the tests we are altering the time to cover certain scenarios.

We saw the following behavior:

Using the environment variable FAKETIME is working to set an initial time, but adapting of the time is not changing the time in the running process.

Using the library over the file approach (Using .faketimerc, /etc/faketimerc or a custom file set by FAKETIME_TIMESTAMP_FILE):

  • When starting the process with an existing file is blocking the process start and the process is blocked forever
  • When creating a file during runtime has no influence on the process time

Is there anything we missed or a different approach we can follow?

MWild67 avatar Mar 11 '25 11:03 MWild67

I have the same issue, a solution for this would be nice.

rfaes avatar Apr 07 '25 11:04 rfaes

Please try using the file-based mechanism for other processes to make sure it basically works on your system and only fails with dotnet. I don't know how libfaketime could lock up during accessing its configuration file unless dotnet somehow influences standard filesystem access. It would be good to know then whether it really just hangs or goes into some kind of loop; in either case, it might be hard to fix this on libfaketime's end. If you cannot influence the value of the environment variable at run-time and the file-based approach does not work, you'll probably have to control libfaketime via its shared memory, which is the most low-level and least comfortable way.

wolfcw avatar May 24 '25 08:05 wolfcw

We used the file-based mechanism and it worked with other processes, but as soon as we use the dotnet process it is not working.

MWild67 avatar Jun 06 '25 12:06 MWild67