Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

vp run: task output forwarding aborts with EAGAIN when stdout turns non-blocking mid-run (follow-up to #2165)

未关闭
#2,824 3 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@naokihaba 已经在做这个了。

开始于 2026年9月25日。

评估

这个 Issue 还没有评估数据。

描述

bug
Describe the bug

vp run -r <task> aborts with Failed to forward task process output: Resource temporarily unavailable (os error 11) (Linux, GitHub Actions) or os error 35 (macOS), then kills the other running tasks (exit 137). No test fails; the run is lost because output forwarding hit EAGAIN.

This is the same root cause as #2165. The fix there (#2173, ensureBlockingStdio() at startup) is present in our version, but it clears O_NONBLOCK only once. The flag gets set again mid-run on the shared stdout description, and the task-output forwarding path does not handle WouldBlock.

What we observed

We sampled os.get_blocking(1) every 50–200 ms from a sibling process sharing the same stdout pipe, with a deliberately slow reader (… | (sleep 25; cat)):

Run Non-blocking windows on the shared stdout
vp run -r test, full workspace 0.1–0.3 s, then 25.4–28.6 s, even when invoked as ./node_modules/.bin/vp (no package manager in between)
vp run --filter <pkg> test, where test is a package.json script running playwright test 1.4–4.5 s
playwright test on its own 0.4–3.6 s
  • The mid-run window appears when the reader starts draining a full pipe. That points at Node re-marking its non-TTY stdout non-blocking under backpressure. Any ForwardTaskProcessOutput write landing in that window fails with EAGAIN.
  • Uncached tasks make it worse. vite-task runs them with inherited stdio (crates/vt/src/session/execute/mod.rs: Uncached { pipe_writers: None } => SpawnStdio::Inherited), so a Node child such as Playwright marks the shared description non-blocking for seconds while other tasks' captured output is being forwarded.
  • A regular-file sink never fails (vp run -r test > out.log), which is consistent with EAGAIN on the write side.
Reproduction
  1. A workspace with several vp test tasks producing a few thousand lines of output, plus one package whose test is a package.json script (uncached, so it inherits stdio) running a Node tool, for example playwright test.
  2. Run with a stdout consumer that lags:
    vp run -r test 2>&1 | (sleep 25; cat > /dev/null)
    vp run --last-details
    
  3. The details show one task with ✗ Error: Failed to forward task process output: Resource temporarily unavailable (os error 35) and the rest ✗ (exit code: 137).

On GitHub Actions it reproduced on 2 of 2 runs for one change set, and passed once we removed one test task from the run, which changed the task schedule. That makes it timing dependent, and silent until it isn't.

Versions
  • vite-plus 0.2.9, which already calls ensureBlockingStdio() in dist/bin.js.
  • Node 24.21, macOS 26.5 (arm64) and GitHub Actions ubuntu-24.04-arm.
  • We have not run 0.3.x or 1.0.0-rc.0, but vite-task main (8dd41bc8) has no WouldBlock handling in pipe_stdio / ForwardTaskProcessOutput. #2785 adds a retrying writer only for --version and env list-remote.
Suggested fix
  • Retry WouldBlock in the forwarding writer (poll the fd for writability, then retry), like the print_and_flush helper from #2785, rather than treating EAGAIN as fatal.
  • Alternatively, or as well, re-assert blocking mode on the sinks before writing. Clearing it once at startup cannot cover Node re-marking the description later, or inherited children marking it.
Workaround

Send vp's output to a regular file in CI and print it afterwards (vp run -r test > log 2>&1; rc=$?; cat log; exit $rc).

Related: #2165, #2173, #2169, #2785.

主要语言
Rust
星标
5.8k
派生
267
平均合并
21 小时 16 分钟
30 天内合并 PR
147

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

voidzero-dev/vite-plus 的其他 Issue

查看 voidzero-dev/vite-plus 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。