Repository navigation
fix(lorectl): answer a hook at the end of its JSON, not when stdin closes - #414
Merged
Merged
Conversation
…oses Hooks read stdin to end of file, so a parent that kept the pipe open, or a child that inherited its write end, held every hook until it exited (up to the plugin's 10s timeout). The hook now parses the first JSON value.
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
stdin_jsonincrates/lorectl/src/hook.rsparses the first JSON value from stdin (still capped at 1 MiB) instead of reading to end of file.Why
A hook waited for stdin to close before doing anything. A parent that writes the event but keeps the pipe open, or any process that inherited the pipe's write end, held every hook until it exited, up to the plugin's 10s timeout. This is also part of why
hooks_go_on_without_a_working_tree_that_does_not_answerfails when lorectl's test binaries run together: on macOS a pipe is briefly inheritable, so a sibling test's child can keep the hook's stdin open.Test
New
a_hook_answers_while_its_stdin_stays_open: writes the event, keeps the pipe open 5s, and requires the hook to exit first. It fails on main (5.87s, "the hook waited for stdin to close") and passes here.cargo test -p lorectl --no-fail-fastpasses except the stuck-tree timing test, whosesession-startrun can still take ~6s under parallel load; that is a separate cause, under investigation.