Repository navigation
Wait for the paused relay consumer and tighten the test's failure paths - #1829
Merged
Merged
Conversation
On ppc64le,
test_pipeline_writer_relay_lends_only_while_a_producer_waits[True]
failed with:
AssertionError: assert 1114112 == 1163264
The child's last write unblocks once the relay has forwarded about
capacity + 65536 bytes, 1114112 with 64 KiB pages. The consumer may
still need more forwarded to reach first_read, and the test asserted
as soon as the lend was returned, without waiting for it.
Wait up to 5 seconds for the consumer to reach first_read. Its reads
are capped there, so the equality check still holds.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1829 +/- ##
=======================================
Coverage 99.75% 99.75%
=======================================
Files 23 23
Lines 6665 6665
=======================================
Hits 6649 6649
Misses 16 16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
The consumer now sets an event once it has read its first page, and the test waits on that instead of polling the byte count. A timeout fails with a message that says so, where it used to look like the byte-count mismatch of the original race. The consumer's first read loop also stops on end of file, so a relay that closes the pipe early fails the test instead of spinning.
Cleanup set resume but not lent, so a test that failed before the first lend left the consumer in lent.wait(10) while cleanup joined it for the same 10 seconds. Each such failure took 10 seconds, and a join that lost the race closed the read descriptor under a live thread. Set lent in cleanup as well. Correct the comment on the consumer's end-of-file check, and the reason the previous commit gave for it. The writer keeps its own write end of the pipe, so the relay cannot close it early. End of file arrives only once cleanup closes the writer, and the check stops the consumer spinning on empty reads after that.
A timeout on either of the consumer's waits let a slow run read ahead: past its first page before cmd2's write, or before any lend. The test could then pass without exercising what it is for. Its cleanup releases both waits, so neither needs a timeout to end.
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.
The paused relay test could fail on ppc64le when the child exited and returned the terminal before the consumer finished its first read. Steve Traylen’s fix gives the consumer up to five seconds to reach
first_readbefore the test goes on to check the final output order.This branch includes Steve’s original commit from #1826 and the payload calculation from #1825. The slack stays fixed at 16,384 bytes. Review discussion and reproduction results.
Follow-up changes
Two later commits came out of code review of the test. They change only
tests/test_utils.py.pausedevent once it has read its first page, and the test waits on that event instead of polling the byte count. The consumer’s reads stop at that page until it is resumed, so the rest of the output is still in the relay when cmd2 writes after it. A timeout now fails with a message that says so. Before, it looked like the byte-count mismatch of the original race.lentas well asresume. A test that failed before the first lend used to leave the consumer inlent.wait(10)while cleanup joined it for the same 10 seconds. Each such failure took 10 seconds, and a join that lost the race closed the read descriptor under a live thread.Verification
Of the original fix:
With the follow-up commits:
lentchange it took 10 seconds per case.make checkandmake docs-testalso passed.