Conversation
… throw on ARM Linux (hotplug skew) — see CodebuffAI#1374 ### Patch refined and tested The patch in commit `1333802` is close, but the `cpus()` pre-check needs a fix: on Bun's ARM Linux runtime with CPU hotplug skew, `os.cpus()` can throw synchronously, so calling `cpus()` without a `try/catch` can crash before we ever reach the guarded `si.cpu()`. Updated patch: - `cpus()` wrapped in `try/catch` — if it throws, return empty values + `logger.warn` immediately. - `systeminformation.cpu()` in `try/catch` — catches the uncaught exception from the `nextTick` callback inside `lib/cpu.js:956`. - `Promise.all` now uses `getCpuInfoSafe()` (removed the duplicate `systeminformationModule.cpu()` call). - Fallback logging via the existing `logger` (`fingerprintType: cpu_pre_check_failed` / `cpu_info_failed`). Diagnosis confirmed via the mount-namespace workaround: - frozen CPU snapshot (8 CPUs consistent across /proc/stat, /proc/cpuinfo, /sys/devices/system/cpu/online) → CLI stays up. - live skewed state (9/8/9) → crash ~3s after start. Fallback behavior: fingerprint still generates (empty CPU fields or legacy path); process is stable, not ideal for fingerprinting uniqueness but no longer crashes.
|
Thanks for digging into #1374 - the instinct to guard fingerprinting so it can't take down the CLI is correct, and the Two things concern me before this is portable:
Given the crash you're describing is intermittent and hardware-dependent, this really needs a unit test that mocks |
… throw on ARM Linux (hotplug skew) — see #1374
Patch refined and tested
The patch in commit
1333802is close, but thecpus()pre-check needs a fix: on Bun's ARM Linux runtime with CPU hotplug skew,os.cpus()can throw synchronously, so callingcpus()without atry/catchcan crash before we ever reach the guardedsi.cpu().Updated patch:
cpus()wrapped intry/catch— if it throws, return empty values +logger.warnimmediately.systeminformation.cpu()intry/catch— catches the uncaught exception from thenextTickcallback insidelib/cpu.js:956.Promise.allnow usesgetCpuInfoSafe()(removed the duplicatesysteminformationModule.cpu()call).logger(fingerprintType: cpu_pre_check_failed/cpu_info_failed).Diagnosis confirmed via the mount-namespace workaround:
Fallback behavior: fingerprint still generates (empty CPU fields or legacy path); process is stable, not ideal for fingerprinting uniqueness but no longer crashes.
Closes #1374