fix(scripts): stop treating command failure as a pattern match - #160
Merged
Conversation
Three related ways a shell test reported the wrong answer, all by letting a producer's exit status stand in for -- or be mistaken for -- the result of the match. `grep -q` exits on first match and closes the pipe while the producer may still have a pending write. The producer dies on SIGPIPE with 141, and `pipefail` promotes that to the pipeline's exit status, so the test reads as "no match" even when the pattern is present. It is a race on syscall interleaving, not a size threshold, so it fires intermittently and the odds worsen as the scanned output grows. The three `_wait_for_tx_*_tx` helpers hung a full 7200s timeout each, then failed cluster start, because a healthy tx tool fills the last 100 log lines with the very pattern being matched -- so the match lands on line 1, leaving `tail` with the most left to write. The healthier the tool, the likelier the false negative. Keep the producers out of the pipelines. `check_spend_success` folded the query and the match into one condition, so a failing `query utxo` produced no output, no `lovelace` match, and the negation returned 0 -- inputs reported as spent, retry loop skipped. Reachable both through the SIGPIPE above and through any ordinary query error. Capture the query and test its status separately. `grep -c` exits 1 when it counts zero, so the CC registration check aborted at the ERR trap instead of reaching its own error message.
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.
Three related ways a shell test reported the wrong answer, all by letting a producer's exit status stand in for -- or be mistaken for -- the result of the match.
grep -qexits on first match and closes the pipe while the producer may still have a pending write. The producer dies on SIGPIPE with 141, andpipefailpromotes that to the pipeline's exit status, so the test reads as "no match" even when the pattern is present. It is a race on syscall interleaving, not a size threshold, so it fires intermittently and the odds worsen as the scanned output grows. The three_wait_for_tx_*_txhelpers hung a full 7200s timeout each, then failed cluster start, because a healthy tx tool fills the last 100 log lines with the very pattern being matched -- so the match lands on line 1, leavingtailwith the most left to write. The healthier the tool, the likelier the false negative. Keep the producers out of the pipelines.check_spend_successfolded the query and the match into one condition, so a failingquery utxoproduced no output, nolovelacematch, and the negation returned 0 -- inputs reported as spent, retry loop skipped. Reachable both through the SIGPIPE above and through any ordinary query error. Capture the query and test its status separately.grep -cexits 1 when it counts zero, so the CC registration check aborted at the ERR trap instead of reaching its own error message.