Replace Fatal calls with retries when zcashd becomes unavailable#550
Open
zmanian wants to merge 1 commit intozcash:masterfrom
Open
Replace Fatal calls with retries when zcashd becomes unavailable#550zmanian wants to merge 1 commit intozcash:masterfrom
zmanian wants to merge 1 commit intozcash:masterfrom
Conversation
BlockIngestor crashed with Log.Fatal on any getbestblockhash RPC failure, meaning a temporary zcashd restart or network glitch would kill lightwalletd. Now retries with exponential backoff (8s, 16s, 32s, 64s, capped at 2 minutes), logging the first failure and re-logging every 5 minutes during sustained outages to avoid filling the filesystem. Logs a recovery message when zcashd comes back. Also converts three Log.Fatal calls in getBlockFromRPC to returned errors (already retried by BlockIngestor), converts the Cache.Add Fatal to a retry, and changes the getblock failure log level from Info to Warn. Fixes zcash#416 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
087d30e to
7f81ece
Compare
83acb35 to
7f81ece
Compare
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.
Summary
Log.Fatalon anygetbestblockhashRPC failure, meaning a temporary zcashd restart or network glitch would kill lightwalletd immediatelyLog.Fatalcalls ingetBlockFromRPCto returned errors (already retried by BlockIngestor's existing retry logic)Cache.Addfailure fromLog.Fatalto a logged warning with retryAs discussed in #416, the consistent behavior should be for lightwalletd to retry RPCs indefinitely rather than crashing, since zcashd can restart for many reasons and some monitoring process should handle zcashd availability independently.
Closes #416
Test plan
go build ./...passesgo vet ./common/...passesgo test ./common/...passes (all 11 tests including TestBlockIngestor)Generated with Claude Code