Repository navigation
fix(backup): a malformed request fails its own result instead of crashing the service - #61
Merged
Merged
Conversation
…hing the service A request file that is not JSON used to raise out of handle() and end the serve loop; the file was left as .running, so every restart crashed again on the same file until it was removed by hand. The order is now parsed inside the try, so a bad request writes a failed .result and is removed, and the restart sweep tolerates a .running file it cannot parse.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
handle()parses the request inside itstry, so a request file that is not JSON (or names no action) writes a failed.resultand is removed, instead of raising out of the serve loop..runningfile it cannot parse, so the service no longer crash-loops on the same file after a restart.Why
Found during the Graphite Hub phase 7 verification: a hand-written request with broken quoting crashed
backup-backup-1, and because the file had already been renamed to.running, every restart crashed again at the sweep until the file was deleted by hand.Verified
Ran
handle()from the patched script against a scratch root with a malformed request, an unknown action and a stale malformed.runningfile: all three produceok: falseresults with the reason, the files are cleaned up, and the loop continues.