Conversation
scanForReady reads the func run child's stdout with a bufio.Scanner limited to 1 MiB per line. A longer line ended the scan loop, and the deferred Close closed the pipe, so the child's next write got SIGPIPE and the local run died. Keep draining stdout with io.Copy(io.Discard, r) after the loop, so the pipe stays open for the life of the child. Fixes knative#4227
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: anjalirj27 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @anjalirj27. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Changes
scanForReadykeeps draining thefunc runchild's stdout after its scanner stops. A single line over the scanner's 1 MiB limit ended the loop and the deferredCloseclosed the pipe, so the child's next write got SIGPIPE and the local run died./kind bug
Fixes #4227
Why: a Function that logs one long line (for example a large JSON dump) stopped the local run started by the MCP
runtool. Reproduction is in #4227.Testing:
TestDefaultProcessStarter_LongStdoutLine: a fakefunc runprints the ready line, a 2,000,000-character line, then one more line and creates a marker file. It fails without the fix (process exited after writing a stdout line over 1 MiB) and passes with it.go test -race ./pkg/mcp/...andmake checkpass.Note for reviewers: after the scanner stops, later stdout lines are discarded, so they no longer reach the tail buffer used in error messages. The ready line always comes first, so readiness is unaffected. If you'd rather keep those lines, I can switch to a
bufio.Readerthat truncates long lines instead.Release Note
Docs