macOS: sfw-free proxy can busy-loop at ~80% CPU and never exit after mid-request network interruption; copies accumulate
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- macos, node.js
- Domain
- cli, devtools, operating-systems
Research direction
Start by reproducing the macOS-only failure with the sfw-free v1.10.0–v1.12.0 proxy during a mid-request interruption, especially across sleep/wake. Inspect the Node SEA proxy's libuv/kqueue event-loop behavior around the dead or half-closed socket. Done means interrupted requests exit cleanly without persistent CPU spin or accumulating proxy processes, while checking whether Linux remains unaffected.
Written by the indexing model from the issue text.
Description
Summary
On macOS, after a mid-request network interruption, sfw-free proxy processes can get stuck in a persistent CPU spin and never exit. I observed 17 accumulated proxy processes at ~80% CPU each after overnight sleep/wake cycles. I could not reproduce the spin on Linux, which points toward a possible macOS/kqueue-specific event-loop issue.
I did a fair amount of digging (details + measurements below) and it looks like a libuv event-loop spin on a dead/half-closed socket that is specific to macOS (kqueue) I could not reproduce it on Linux. I have not been able to pin the exact line.
Possibly related: #38 (runaway processes when npm/npx are globally wrapped) and #25 (signal/lifecycle handling).
Environment
- macOS (Apple Silicon, arm64)
sfw(npm wrapper) v2.0.6sfw-freebinary v1.10.0 at the time of the incident; I separately confirmed the cited source is unchanged through v1.12.0 (current latest), so it still appliesnpm/npxglobally wrapped via a PATH shim, so every package-manager call routes throughsfw(same setup as #38)- Trigger: a background process that ran
npm view <pkg>@latest version --prefer-onlinerepeatedly (≈ hourly in this incident), across overnight sleep/wake cycles
Symptoms (observed)
17 sfw-free proxy processes (the Node SEA that spawns the package manager) alive simultaneously. Activity Monitor showed all 17 at 79.6–82.0% CPU; a few rows (instantaneous %CPU and accumulated CPU time):
%CPU CPU TIME PROCESS
82.0 17:07.89 sfw-free-macos-arm64
81.7 12:48.21 sfw-free-macos-arm64
81.2 25:18.32 sfw-free-macos-arm64
… (17 rows total)
ps confirmed all 17 were state R (on-CPU), on the same TTY, ~250 MB RSS, each running:
sfw-free-macos-arm64 npm view <pkg>@latest version --prefer-online
- Start times were spread ~1/hour across ~19 hours (12:44 PM → 8:05 AM the next day), matching the update-check interval plus overnight sleep/wake.
- At that moment the machine was at 97% user / 0% idle.
- The same command run fresh completes in ~2.7s, so this is a state-dependent hang.
- Dominant language
- No language data
- Stars
- 271
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SocketDev/sfw-free
-
Difficulty 1/5 Under an hour Newbie friendliness 87/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in SocketDev/sfw-free
Similar issues
-
manually bump balena-preload to ^19.0.6Possibly taken @shaunmulligan claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 66/100
balena-io/balena-cli#3200 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ranxianglei/billion-context#7858 ·
Maintainers usually reply within 1 day
-
Bash init calls `cygpath` unconditionally on Windows, which breaks non-Cygwin shells like `brush`Possibly taken @iliqiliev claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ajeetdsouza/zoxide#1381 ·
Maintainers usually reply within 5 days
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MakazhanAlpamys/Soup#3415 ·
Maintainers usually reply within 1 day