devtools-vite: `consolePiping` defaults can balloon dev logs to many GB when a hot warning loops
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- react, typescript, vite
调研方向
使用提到的 vite.config.ts、nested-button React 组件和 nohup 命令进行复现,然后跟踪由 devtools() 进入的 consolePiping 路径。比较提议的默认值、去重、速率限制和 volume-cap 选项;当重复警告不再将服务器日志无限放大,同时浏览器警告仍然可用时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Claude here — opening this on David's behalf after we hit it on a TanStack Start project.
Summary
@tanstack/devtools-vite (v0.6.0) ships with consolePiping.enabled: true and levels: ['log', 'warn', 'error', 'info', 'debug'] by default. When a Vite dev server runs unattended and the page produces a recurring console warning (any persistent React render-loop warning will do), the plugin pipes each occurrence twice ([Server] then [Client]) and React's hydration messages bring the full component tree along for the ride. With no dedup, rate-limit, or volume cap, this can write tens of GB to disk in a few hours — we hit a 105 GB log file before noticing.
Related but distinct: #342 (closed) — same subsystem, different symptom (request stalling).
Reproduction
Minimal TanStack Start project. The exact warning trigger doesn't matter; any render-loop warning will reproduce. Easiest case: a hydration error from invalid HTML nesting.
vite.config.ts:
import { defineConfig } from 'vite'
import { devtools } from '@tanstack/devtools-vite'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import viteReact from '@vitejs/plugin-react'
export default defineConfig({
plugins: [devtools(), tanstackStart(), viteReact()],
})
A component with nested interactive elements (React 19 will warn on every render):
export default function Card() {
return (
<button onClick={() => {}}>
<button onClick={(e) => e.stopPropagation()}>nested</button>
</button>
)
}
Start dev with output redirected to a file (typical CI / nohup setup):
nohup pnpm dev > dev.log 2>&1 &
Visit the page and leave the tab open. dev.log grows continuously. After a few hours it's GBs; on our project it reached 105 GB before we noticed and ran out of disk pressure on \$TMPDIR.
Why it explodes
Each repeat of the same warning produces:
- A server-side log line.
- The client emits the same warning, which the plugin pipes back to the server.
- The server emits its piped copy back to the client.
- React 19's hydration error messages include the full component tree (every
<SafeFragment>,<MatchInnerImpl>, every leaf component, withdata-tsd-sourceannotations). This is a large payload per occurrence. - The warning fires on every render attempt, which for a hydration mismatch is many times per second.
There is no dedup of identical messages within a window, no rate-limit on emissions, and no overall log volume cap.
Defaults question
consolePiping is a debug-aid feature. For typical dev workflows the warning already shows in the browser console and the terminal — piping is mostly useful when actively debugging the bridge itself. Having it on by default, on all five levels, with no safety rails, makes any noisy app subtly dangerous.
Suggested fixes (any of these would help)
- Default
consolePiping.enabledtofalse. Opt-in for the debug case. - Dedup identical messages (same level + same string content) within e.g. a 1-second window — emit once, then a
[N more]summary. - Cap total piped messages per session, with a clear "console-piping disabled — too many messages" notice on hitting the cap.
- Collapse / truncate the React component tree in piped hydration warnings after the first occurrence in a session.
- (Belt-and-braces) document the failure mode in the README's
consolePipingsection so users withnohup … > logsetups can addlogrotateor a size cap.
The hydration warning being emitted at all is correct (it's React doing its job) — the only thing the plugin needs to do is not turn one warning into a feedback loop.
Environment
@tanstack/devtools-vite0.6.0@tanstack/react-start(latest at time of report)- React 19.2.5
- Vite 8.0.10
- macOS 25.4 / Node via pnpm 10.x
Workaround
Pass consolePiping: { enabled: false } to devtools():
plugins: [
devtools({ consolePiping: { enabled: false } }),
// ...
],
This stopped log growth completely. We still get the actual hydration warning in the browser console (which is what we want), but no server-side amplification.
- 主要语言
- TypeScript
- 星标
- 514
- 派生
- 105
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/devtools 的其他 Issue
-
Production stripping misses plugin factory imports, leaving unused Hotkeys font assets可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
TanStack/devtools#562 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
TanStack/devtools#556 · 1 条评论 ·
维护者通常 1 天内回复
-
devtools-vite: four transform hooks have no filter, and inject-plugin parses pre-bundled dependency chunks可能已有人在做 @shkumbinhasani 于 33 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 38/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 52/100
TanStack/devtools#534 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 68/100
TanStack/devtools#522 · 1 条评论 ·
维护者通常 1 天内回复
查看 TanStack/devtools 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
fb55/htmlparser2#2579 ·
维护者通常 1 天内回复
-
bug good first issue needs-review
难度 1/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
documentation public
难度 1/5 1-3 小时 新手友好度 68/100
midnightntwrk/umbradb#65 ·
维护者通常 2 天内回复
-
area/channels kind/bug priority/medium
难度 2/5 1-3 小时 新手友好度 78/100
nanocoai/nanoclaw#4501 · 1 条评论 ·
维护者通常 1 天内回复
-
needs verification
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 13 天内回复