Tezt cloud signal flagging
What
Defer call to set_logfile from signal handler to main control flow.
The handler is now just updating a boolean flag.
The previous code could have raise an undefined behavior if the set_logfile was taking too much time (but my personal take is that it is unlikely). Despite that, the code should be less "risk"-prone.
Why
This is an attempt to fix some issues we observed on public deployments when tezt-cloud shutdown properly at rounded time (2:00:00, 10:00:00), without raising some issues, and without the system showing signs of hostile environment (memory ok, disk space ok, etc.).
How to test
How to test the reopen_logfile is pretty simple, but testing it solves the shutdown issue cannot be done without waiting 2 weeks and see if it happens again.
Test the reopen_logfile
# in a terminal A
teztcloud DAL --dockerfile-alias baugr --tezt-cloud baugr -v --log-file /tmp/log --bootstrap --localhost
# Wait a little bit the deployment is started
# in a terminal B
tail -F /tmp/log
# in a terminal C
kill -HUP $(pidof main.exe)
# After this command, terminal B should show, somewhere a
/tmp/log: file truncated
# And terminal A should show, somewhere a :
[08:21:27.508] Reopening logfile : /tmp/log