Registry Mirror
Skip to content

Conversation

@anjalirj27

Copy link
Copy Markdown
Contributor

Changes

  • 🐛 scanForReady keeps draining the func run child's stdout after its scanner stops. A single line over the scanner's 1 MiB limit ended the loop and the deferred Close closed 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 run tool. Reproduction is in #4227.

Testing:

  • Regression test TestDefaultProcessStarter_LongStdoutLine: a fake func run prints 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/... and make check pass.

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.Reader that truncates long lines instead.

Release Note

The MCP run tool no longer stops a local Function that writes a stdout line longer than 1 MiB.

Docs


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
@knative-prow knative-prow Bot added the kind/bug Bugs label Nov 30, 2026
@knative-prow

knative-prow Bot commented Nov 30, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: anjalirj27
Once this PR has been reviewed and has the lgtm label, please assign matejvasek for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow Bot added size/M 🤖 PR changes 30-99 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels Nov 30, 2026
@knative-prow

knative-prow Bot commented Nov 30, 2026

Copy link
Copy Markdown

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Bugs needs-ok-to-test 🤖 Needs an org member to approve testing size/M 🤖 PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP: a stdout line over 1 MB from func run kills the local run

1 participant