已关闭
[issue] 编译器超时仅报 "status 124",timed_out 未透出 #16
cezarbbb创建于 9月9日关闭于 23 天前
WangZijun
25 天前 评论:
25 天前 评论:
https://gitcode.com/xuanwu/bot-metric/pull/14
结论:
- 问题可以复现:修复前的最小复现与回归测试确认了 issue 描述的行为。
- 问题可以修复:当前分支的针对性测试和全量质量门禁均已验证修复结果。
具体修复:
- 为 Cargo、Clippy 和 rustc 编译器运行结果增加向后兼容的
timed_out结构化字段。 - 保留超时退出码 124 与 partial 语义,并让 BM302 明确说明进程因超时终止。
- 增加真实 Cargo 超时、序列化兼容性与三类 provider 传播路径的回归覆盖。


问题概述
--compiler-timeout-secs触发超时后,错误为 BM302 "cargo provider exited with status 124":消息无 timeout 字样,诊断中无结构化 timed_out 字段,用户需知晓 124 为超时惯例才能归因。首次出现版本:v1.0.0 即存在,v1.1.0 延续。受影响对象:启用--cargo-check/--rustc-check/--clippy-check的所有输入。实际影响:超时与编译器其他失败(如依赖缺失)难以区分,自动化归因困难。本问题涉及诊断字段口径,不涉及指标数值。影响范围
--compiler-timeout-secs语义复现步骤
最小源码样例:夹具
fixtures\slow-compile(fib(38) 泛型宏展开,冷编译 x86 约 4.7s / ARM64 约 14.79s,确保可触发 2s 超时)。自包含最小样例如下(与测试夹具 slow-compile 同构:泛型宏单态化 + 生成大文件;下述命令中的<slow-compile>即指向该样例目录):Cargo.toml:[package] name = "slow-compile" version = "0.1.0" edition = "2021"src/lib.rs:// slow_compile.rs - heavy generic monomorphization to stress compiler timeout tests. pub mod gen; pub trait Visitor { type Out; fn visit(&self, depth: usize) -> Self::Out; } macro_rules! make_node { ($name:ident) => { pub struct $name { pub children: Vec<Box<dyn Visitor<Out = String>>>, } impl Visitor for $name { type Out = String; fn visit(&self, depth: usize) -> String { let mut acc = format!("{}node", depth); for c in &self.children { acc.push_str(&c.visit(depth + 1)); } acc } } }; } make_node!(NodeA); make_node!(NodeB); make_node!(NodeC); make_node!(NodeD); make_node!(NodeE); make_node!(NodeF); make_node!(NodeG); make_node!(NodeH); pub fn build_deep() -> NodeA { fn leaf(d: usize) -> Box<dyn Visitor<Out = String>> { struct Leaf { depth: usize, } impl Visitor for Leaf { type Out = String; fn visit(&self, _d: usize) -> String { format!("leaf{}", self.depth) } } Box::new(Leaf { depth: d }) } let mut children: Vec<Box<dyn Visitor<Out = String>>> = Vec::new(); for i in 0..64 { children.push(leaf(i)); } NodeA { children } }src/gen.rs生成脚本(Python,与测试夹具 gen.rs 同构:5102 行、约 74 个生成函数,每个函数 64 条wrapping_add链):# gen_gen.py — 在 slow-compile 目录下执行:python gen_gen.py with open("src/gen.rs", "w", encoding="utf-8") as f: f.write("// gen.rs - generated large file for compiler timeout tests\n\n") for i in range(74): f.write(f"pub fn gen_fn_{i}(x: u64) -> u64 {{\n") f.write(" let mut acc = x;\n") for k in range(64): f.write(f" acc = acc.wrapping_mul(3).wrapping_add({k});\n") f.write(" acc\n}\n\n")BM110 analyze <slow-compile> --cargo-check --compiler-timeout-secs 2 --format json预期结果
错误消息标明超时(含 timeout 字样),或诊断含结构化字段(如 timed_out=true),使超时可被机器归因。
实际结果
BM302 "cargo provider exited with status 124",无 timeout 字样、无 timed_out 字段;x86 wall 2.09s(SIGKILL)、ARM64 wall 2.59s(2.15s 终止 cargo),无孤儿进程残留。ARM64 批次 9 复现(R6)实测通过。证据:
x86_linux\records\batch-09\verify-groupC_6-3.txt;arm_linux\records-arm64\batch-09\verify-groupC_6-3.txt、arm_linux\records-arm64\batch-06\out\t66-slow-timeout2.json。证据原文(x86_linux\records\batch-09\verify-groupC_6-3.txt):
证据原文(arm_linux\records-arm64\batch-09\verify-groupC_6-3.txt):
证据原文(arm_linux\records-arm64\batch-06\out\t66-slow-timeout2.json,共 947 行,节选 compiler_run 与 BM302 诊断部分):
"compiler_run": { "command": [ "cargo", "check", "--manifest-path", "fixtures/slow-compile/Cargo.toml", "--message-format=json", "--offline" ], "toolchain": "rustc 1.98.0 (88d9e12ae 2026-08-18)", "exit_code": 124 }, "errors": [ { "code": "BM302", "message": "cargo provider exited with status 124" } ],……(节选,完整文件见
arm_linux\records-arm64\batch-06\out\t66-slow-timeout2.json;顶层 diagnostics 数组重复同一条 BM302:{"file": null, "line": null, "column": null, "code": "BM302", "level": "error", "message": "cargo provider exited with status 124", "source": "analysis"},无 timed_out 字段)分析环境与范围
--cargo-check --compiler-timeout-secs 2 --format json指标、发现与报告证据
t66-slow-timeout2.json与 verify-groupC 证据文件性能与资源证据
附件与提交确认