Repository navigation
Open
Description
Description
跟踪 TUI 原生退出问题及 Bun 1.4.4 升级验证。原始 TUI 事故缺少 core,最后一条 LLM 日志不能定位 native faulting frame,因此目前不认定 fetch、TLS、SQLite 或 Worker 是现场根因。
下面只记录独立的合成复现及测试结果,不包含现场运行标识、业务内容、时间戳或数据规模。
OpenCode version
当前仓库构建运行时固定为 Bun 1.3.14;计划升级至 Bun 1.4.4。需要重新编译可执行文件,才能替换其内嵌运行时。
Steps to reproduce
在本地启动延迟 3 秒响应的 HTTP 服务。8 个并发 Worker 各发起 8 个 fetch;收到 Worker 已发起请求的消息后等待 2 ms,再终止 Worker,目标 400 轮。
| Bun | 三次独立运行 |
|---|---|
| 1.3.13 | 3/3 原生崩溃 |
| 1.3.14 | 3/3 原生崩溃,约 3.1–3.6 秒 |
| 1.4.4 | 3/3 完成 400 轮,无崩溃 |
旧版 stderr 为 panic: Segmentation fault at address 0x0;最终进程信号为 SIGILL。1.3.14 的无 fetch 对照 400 轮通过,把终止延迟改为 3.1 秒的 40 轮对照也通过;后者没有显式等待所有请求完成。
这个独立 Worker/fetch 复现尚未证明与 TUI 事故同根因。
独立复现代码:两个文件放在同一目录,执行 bun worker-teardown.ts
worker-fetch.ts
declare const self: Worker;
self.onmessage = (event) => {
if (event.data.type !== "work") return;
const pending = event.data.noFetch ? [] : Array.from({length: 8}, () => fetch(event.data.url).then(r => r.text()).catch(() => {}));
const garbage = Array.from({length: 20000}, (_,i) => ({i,s:`value-${i}`}));
self.postMessage({type:"started", n:garbage.length});
// Retain in-flight work until completion or termination.
void Promise.all(pending);
};worker-teardown.ts
const cycles = Number(process.env.CYCLES ?? 400);
const concurrency = Number(process.env.CONCURRENCY ?? 8);
const mode = process.env.MODE ?? "terminate";
const server = Bun.serve({hostname:"127.0.0.1",port:0,async fetch(){await Bun.sleep(3000);return new Response("ok");}});
let started=0, completed=0;
console.log(JSON.stringify({event:"start",bun:Bun.version,revision:Bun.revision,cycles,concurrency,mode}));
await Promise.all(Array.from({length:concurrency}, async()=>{
while(started<cycles){
started++;
const worker=new Worker(new URL("./worker-fetch.ts",import.meta.url).href);
await new Promise<void>((resolve,reject)=>{
worker.onmessage=()=>resolve();
worker.onerror=reject;
worker.postMessage({type:"work",noFetch:mode==="no-fetch",url:`http://127.0.0.1:${server.port}/slow`});
});
await Bun.sleep(mode==="graceful"?3100:2);
worker.terminate();
completed++;
if(completed%50===0) console.log(JSON.stringify({event:"progress",completed}));
}
}));
await Bun.sleep(200);
server.stop(true);
console.log(JSON.stringify({event:"done",completed}));Upgrade validation and follow-up
- 升级版本配置及 Docker 镜像到 1.4.4,验证全新安装、现有相关测试和重新编译的二进制。
- 在真实长程工作负载中继续验证,并捕获 core、准确退出信号和运行时 revision。
- 关联升级 PR,但先保持 issue 开放;短测通过不等于原始事故已确认修复。
Operating System
独立复现环境:Linux x64 / glibc 2.39。
Metadata
Metadata
Assignees
Labels
No labels
Activity
test: adapt Solid JSX and WebSocket assertions to Bun 1.4.4
chore(runtime): upgrade Bun to 1.4.4 (#100)