Extension webview can freeze workbench under large Vite modulepreload burst
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- react, typescript, vite
- 领域
- frontend, performance, web-dev
调研方向
首先通过 readFileStream 和 loadResource 跟踪 webview 资源路径,然后在复现报告中的 Codex webview 条目和 webview/index.html 产生的大规模 preload burst 时检查 RequestStore#acceptReply。完成的标准是大型扩展 webview 不再冻结桌面 workbench,也不再产生 listener 泄漏和未匹配请求信号,但该 issue 没有提供独立的 reproducer。
由索引模型根据 Issue 内容生成。
描述
Summary
An extension webview that eagerly preloads hundreds of local Vite chunks can freeze the code-server workbench on desktop Chromium-based browsers.
I originally investigated this as an OpenAI Codex extension issue:
- https://github.com/openai/codex/issues/28726
- final Codex-side follow-up: https://github.com/openai/codex/issues/28726#issuecomment-4762217105
The local workaround was applied inside the Codex extension bundle, but the failure path appears to involve code-server's webview resource loading bridge as well. I am filing this here as a closed informational issue because the same class of problem may affect other large extension webviews.
Environment
- Server OS: Arch Linux
- code-server: 4.123.0 / VS Code base 1.123.0 at the time of local testing
- Extension involved:
openai.chatgpt@26.609.30741, linux-x64 - Affected clients:
- Windows Edge / Chromium-based browsers
- Arch Linux Chromium / Chrome-family browsers
- Less affected client:
- Android Samsung Internet against the same code-server instance
Symptom
Opening the Codex sidebar in code-server caused the browser/workbench UI to freeze shortly after the webview iframe was mounted, before opening any specific thread.
Removing the extension avoided the freeze.
Relevant browser console / server log signals
Browser DevTools showed the freeze path going through workbench webview/resource loading:
potential listener LEAK detected
doReadFileStream
readFileStream
loadResource
The code-server server log also repeatedly showed:
RequestStore#acceptReply was called without receiving a matching request
These messages appeared at the time the sidebar webview was opened.
Local diagnosis
The generated Codex webview entry file contained a large Vite dependency preload list:
~/.local/share/code-server/extensions/openai.chatgpt-26.609.30741-linux-x64/webview/assets/index-CaOlcDW2.js
The relevant pattern was:
await e(() => import("./app-main-FqROzk9D.js"), __vite__mapDeps([0, 1, 2, ... 486]), import.meta.url)
That meant the extension webview attempted to preload hundreds of local JS/CSS assets as soon as the sidebar webview was mounted.
In code-server, those local webview asset requests flow through the browser/workbench resource bridge and extension file loading path. On desktop Chromium clients, this appeared to trigger the readFileStream / loadResource listener leak and RequestStore#acceptReply mismatch, then the workbench froze.
Workaround that fixed the freeze locally
I patched the generated extension webview entry so that only CSS chunks were preloaded, while the hundreds of JS chunks were no longer eagerly preloaded:
__vite__mapDeps([48,94,136,137,166,189,202,210,232,264,315,320,329,384,387,421,469,484,485,486])
I also removed four static modulepreload links from the extension's webview/index.html.
Results:
- Desktop Chromium / Edge no longer froze when opening the webview.
- Android Samsung Internet still rendered the UI correctly.
- Removing the preload list entirely avoided the desktop freeze but broke the UI on Android because CSS chunks were not loaded early enough.
- Keeping only CSS preloads preserved rendering while avoiding the desktop freeze.
Why this may matter for code-server
This was triggered by the Codex extension, but the hard-freeze failure mode seems broader:
- A large extension webview can issue a burst of hundreds of local asset requests.
- code-server's webview resource bridge appears able to enter a listener leak / request mismatch / freeze state under that burst.
- Other large Vite/React extension webviews could potentially hit the same path.
Possible code-server-side mitigations might include:
- throttling or batching webview local-resource requests,
- improving listener cleanup around
readFileStream/loadResource, - making
RequestStore#acceptReplymismatches fail gracefully, - avoiding full workbench freezes when an extension webview preloads too many local resources at once.
Closing note
I am closing this issue myself because I have a local workaround and cannot provide a minimal standalone reproducer right now. I am leaving the report in case it helps future investigation of code-server's webview resource bridge under large modulepreload bursts.
- 主要语言
- TypeScript
- 星标
- 79.4k
- 派生
- 6.9k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 39
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
coder/code-server 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 92/100
coder/code-server#8017 · 2 条评论 ·
-
security
难度 2/5 1-3 小时 新手友好度 74/100
coder/code-server#8013 · 4 条评论 ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
coder/code-server#7976 · 2 条评论 ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
coder/code-server#7962 · 3 条评论 ·
-
bug needs-investigation
难度 4/5 3-5 天 新手友好度 55/100
coder/code-server#7955 · 1 条评论 ·
查看 coder/code-server 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
难度 2/5 1-3 小时 新手友好度 75/100
fil-donadoni/tolaria#4409 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
corsairdev/corsair#1764 ·