Comments (5)
I have an amazing patch that shortens the test runtime to 14s, but it breaks one fragile test (dont_hang_when_program_doesnt_start), BECAUSE THAT TEST IS RACY.
from zdaemon.
dont_hang_when_program_doesnt_start relies on one of two possible sequence of events:
- get_status() reports that daemon manager is not running
- ./zdaemon spawns the daemon manager
- get_status() reports that daemon manager is running but the managed process is not
- get_status() reports that daemon manager is not running
or
- get_status() reports that daemon manager is not running
- ./zdaemon spawns the daemon manager
- get_status() reports that daemon manager is not running until 10 seconds elapse
The test, however, sets up a situation where
- ./zdaemon spawns the daemon manager
- the daemon manager spawns the process
- the process exits with an error message ("sleep: missing operand")
- go to step 2 until backoff-limit is reached (2 seconds)
If the get_status() check hits the window between 2 and 3, the main wait loop will assume the process started correctly and will exit.
Um. I now see that I accidentally moved the time.sleep() inside an if where it should've stayed outside, which made the race easier to hit (and introduced a bug where the timeout was much too short). Once I fixed that the test passes.
from zdaemon.
Ha ha no it doesn't. The race is harder to hit, perhaps, but it's still possible. And the test run time went from 14s to 40 :(.
from zdaemon.
@mgedmin Is this issue still valid or can it be closed?
Currently the tests take about 80 s on Python 3.11 in GHA. So it does not seem to be faster than 8 years ago.
from zdaemon.
I have no plans to work on this, so I suppose it can be closed.
from zdaemon.
Related Issues (18)
- zdaemon transcript thread dies if disk is full HOT 4
- Resurrect logreopen HOT 1
- Kill should accept signal names, not just numbers HOT 6
- Daemon manager ignores 'stop' action while it's busy respawning
- Test breakage on pypy HOT 4
- How to specify relative paths into configuration file? HOT 2
- zdaemon doesn't realise it is managing a different program if nargs < running process
- support for running multiple processes as daemons HOT 1
- Drop support for `python setup.py test`
- use unittest.mock instead of mock HOT 1
- Using zdaemon API instead of providing a config file and document it HOT 5
- PyPy3 tests break HOT 19
- zdaemon -v/--version HOT 2
- zdaemon "reopen_transcript" command is not shown in "zdaemon -h"
- Tests leave running processes HOT 8
- zdaemon never reopens <eventlog>
- Idea: make `logreopen` imply `reopen_transcript` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zdaemon.