Repository navigation
CLI crashes ~3s after start: Failed to get CPU information — proot-distro binds a hardcoded 8-core /proc/stat that disagrees with live /proc/cpuinfo (Termux) #1374
Description
Activity
- addedtype:bugA defect in the code with a reproducible failureA defect in the code with a reproducible failure
on Sep 17, 2026 Workaround that confirms the diagnosis (for anyone hitting this):
- snapshot consistent CPU info (N = cpu count in /proc/stat, first N blocks of /proc/cpuinfo, online range 0-(N-1))
unshare -m+ bind-mount the snapshot over /proc/stat,
/proc/cpuinfo, /sys/devices/system/cpu/online- run freebuff inside that namespace
With the frozen consistent view the CLI starts and stays up; with the live skewed view (9/8/9) it dies ~3s after start. So the crash condition is exactly the cpuinfo/stat/online disagreement, and any handling (try/catch + fallback) only needs to cover that window.
P.S.
Exact spot in code: "cli/src/utils/fingerprint.ts:47" calls "systeminformationModule.cpu()" for the startup fingerprint.Note: the try/catch around it (fingerprint.ts:41-76) cannot catch this crash. In systeminformation@5.33.1, "cpu()" defers via "process.nextTick", and Bun's "os.cpus()" throws there (lib/cpu.js:956, "os.cpus()[0].model"). A throw inside a nextTick callback is an uncaught exception, not a promise rejection, so it bypasses your try/catch AND the legacy-fingerprint fallback in "calculateFingerprint()" — the process just dies (matches the "at processTicksAndRejections" frame in the stack above).
Minimal fix: probe "os.cpus()" in a try/catch before calling
"si.cpu()"; on throw, use the empty-value fallback you already have.closed by accident, issue still reproduces on 0.0.175
- addedarea:cliThe Codebuff/Freebuff terminal clientThe Codebuff/Freebuff terminal clientbot:triagedClassified by the community triage botClassified by the community triage bot
on Sep 17, 2026 - added 2 commits that reference this issue
on Sep 17, 2026 PR #1377 is open with the fix:
Summary of the patch:
getCpuInfoSafe()wrapsos.cpus()andsysteminformation.cpu()in try/catch — returns empty values +logger.warnon fallback.- Replaces the bare
systeminformationModule.cpu()call ingetSystemInfo()'sPromise.all. - Fallback: fingerprint still generates (empty CPU fields or legacy path); process stays stable.
Diagnosis confirmed via mount-namespace workaround (frozen CPU snapshot → CLI stays up; live skewed 9/8/9 → crash ~3s after start).
Closes #1374
- changed the title
[-]CLI crashes ~3s after start: unhandled `Failed to get CPU information` from systeminformation on ARM Linux with CPU hotplug skew (Termux/PRoot)[/-][+]CLI crashes ~3s after start: `Failed to get CPU information` — proot-distro binds a hardcoded 8-core /proc/stat that disagrees with live /proc/cpuinfo (Termux)[/+]on Sep 27, 2026 One more finding from the same investigation, filed separately since it's a resource leak rather than the startup crash: #1443
Every launch unpacks the bundled
libopentui.sointo/tmpanddlopens it without ever deleting it — one file per launch, ~10 MB, with a unique name so nothing is reused. On Android/tmpis a tmpfs, so it is RAM rather than disk: 35 launches in one session left 342 MB resident.It is not Bun's built-in embedded-
.soextraction — that one is deduplicated by name, verified on stock Bun 1.2.21 and 1.4.2. The per-launch unique name here means the CLI unpacks it itself and the unlink afterdlopenis missing.A
TMPDIR=<scratch dir> freebuffwrapper is a working mitigation in the meantime; deleting the file mid-run is also safe, since the library is already mapped at that point.fixed: d86b11d
What happened
freebuff CLI crashes ~3 seconds after start with:
Unhandled rejection: Error: Failed to get CPU information
at cpus (unknown)
at populate (node:os:18:25)
at model (node:os:27:21)
at (../node_modules/systeminformation/lib/cpu.js:956:41)
at processTicksAndRejections (native:7:39)
Exit code 1. The TUI renders (project picker), then the process dies.
Steps to reproduce
Where does this happen?
CLI (terminal client)
Operating system
Linux
Version
0.0.175
Model
No response
Logs or screenshots
Workaround (no code change required)
Rewrite the fake so it carries one line per real CPU and an aggregate line
equal to their sum. The aggregate is the part that is easy to miss: appending
cpu8while leaving the aggregate alone still crashes at ~3s.Verified on 0.0.204 / proot-distro 5.9.0: with the fake corrected the CLI stays
up (survived 35s under
timeout, exit 124, project picker renders); with thestock 8-core fake it exits 1 at ~3s. The generated file is byte-identical to
one produced by building
_FAKE_STATfrom the kernel's CPU count, and thescript is idempotent. Note that
_write_if_missing()never rewrites anexisting entry, so a stale
sysdata/statmust be deleted once for a patchedgenerator to take effect.