Bound all external process calls with a timeout and forced termination
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- java
调研方向
Start with UtilsLinuxOs.getWholeDisks, which already uses the CompletableFuture drain, waitFor(timeout) and destroyForcibly pattern, and compare it with the unbounded calls in UtilsLinuxOs.getPartitionFromFilePath, UtilsMacOs and UtilOs.runPowerShellOneLiner. Before writing code, settle where the shared runCommand helper should live, since the issue leaves that open. Done means every ProcessBuilder call site is bounded and force-destroyed on timeout, returns null or an empty list, and logs a warning.
由索引模型根据 Issue 内容生成。
描述
Background
PR #254 (#252) added proper timeouts to the USB VID/PID lookups on Windows
(UtilsWinOs.getUsbIds, 15 s) and macOS (UtilsMacOs.runCommandLines, 10 s):
output is drained asynchronously, waitFor(timeout) is honoured, and the child
is destroyForcibly()'d on expiry. Review feedback (Copilot) flagged that the
remaining process calls do not follow this pattern.
Problem
Many ProcessBuilder call sites either:
- call
process.waitFor()with no timeout, or - read stdout to EOF with
readLine()before callingwaitFor(n, SECONDS),
making the timeout ineffective, and never destroy the child.
A hung child (stale network mount for df, stalled DiskArbitration for
diskutil, slow/broken WMI for PowerShell) can block drive detection,
benchmark setup, or the UI indefinitely.
Affected call sites (non-exhaustive)
UtilsLinuxOs.getPartitionFromFilePath(df -k),waitFor()without a timeoutUtilsLinuxOs.getDeviceNamesFromPartition(lsblk -no pkname),waitFor()without a timeoutUtilsMacOs:df -k,diskutil info(lines ~92, ~153),system_profiler,
the generic command runner (~208),mount(~318)UtilOs: remainingwaitFor()calls with no timeout (Linux SMART/lsblk/udevadm helpers) and
read-then-waitFor(n)PowerShell helpers (e.g.runPowerShellOneLiner)
Proposed approach
- Use the existing pattern from
UtilsLinuxOs.getWholeDisks:
CompletableFutureoutput drain →waitFor(timeout)→destroyForcibly()infinally. - Consider one shared helper (e.g.
runCommand(timeout, String... cmd) → List<String>)
so call sites stay consistent. Confirm package/location before adding. - Timeouts: 10 s for native tools, 15 s for PowerShell (start-up + WMI).
- On timeout: log at WARNING and return the existing "unavailable" value
(null/empty list) so detection failures never block a benchmark.
Priority
Low–medium. Hangs are rare on Linux (sysfs/statfs), more plausible on macOS
(diskutil) and Windows (PowerShell/WMI).
- 主要语言
- Java
- 星标
- 6
- 派生
- 6
- 平均合并
- 10 小时 11 分钟
- 30 天内合并 PR
- 12
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
JDiskMark/jdm-java 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
enhancement linux
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
documentation linux
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
enhancement linux
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
-
bug linux
难度 3/5 1-2 天 新手友好度 52/100
维护者通常 1 天内回复
查看 JDiskMark/jdm-java 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
bloxbean/yaci-store#1445 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
-
Spare Permission未关闭
难度 2/5 1-3 小时 新手友好度 63/100
Etar-Group/Etar-Calendar#2234 ·
维护者通常 1 天内回复
-
[BUG] MCP resources-as-tools drops invocation context when listing templates可能已有人在做 @CryoThrust 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
langchain4j/langchain4j#7320 ·
维护者通常 1 天内回复