Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes poorly defined behaviour when the scheduler main process crashes.
The original code uses
wait $pid
to wait until themain.py
process exits. This means that if/var/run/bunkerweb/scheduler.pid
still exists afterwait $pid
returns, the contained pid therein is per definition invalid. I.e. if we should assume that a clean exit ofmain.py
means the pid file should have been cleaned up, its mere existence at this point indicates a crash of the process.This PR fixes the logic issues and makes crashes visible in the logs. It additionally tries to restart a crashed process after a delay.
Possibly usage of the
/var/tmp/bunkerweb/scheduler.healthy
file can also be removed (if its only function was to check for crashes), and the entrypoint could be made a bit leaner still.Bonus info: the scheduler process crashed silently (in a podman container) when memory was limited to
100M
, with>= 150M
it appears to work.