Skip to content

perf(ssh): reuse one connection per Spark instead of a login per poll (rebased) - #84

Merged
MikeGibbsOnyx merged 1 commit into
MiaAI-Lab:mainfrom
MikeGibbsOnyx:tode/ssh-connection-reuse
Sep 8, 2026
Merged

perf(ssh): reuse one connection per Spark instead of a login per poll (rebased)#84
MikeGibbsOnyx merged 1 commit into
MiaAI-Lab:mainfrom
MikeGibbsOnyx:tode/ssh-connection-reuse

Conversation

@MikeGibbsOnyx

Copy link
Copy Markdown
Collaborator

Rebased #83 onto 6ab932e+merged 81/82/79. Conflict in SparkMonitor.js resolved keeping both the single-trip liveness optimization and the run-generation commit guard; ssh.js multiplex merged with the credential-isolated control socket (312/312 server tests green). Supersedes #83 (original author Liao Shiwu preserved via cherry-pick); #77 solves the same problem differently.

@MikeGibbsOnyx
MikeGibbsOnyx force-pushed the tode/ssh-connection-reuse branch from 5443ac9 to 63dfe8a Compare September 8, 2026 20:45
@MikeGibbsOnyx
MikeGibbsOnyx merged commit ef5b314 into MiaAI-Lab:main Sep 8, 2026
MikeGibbsOnyx pushed a commit that referenced this pull request Sep 8, 2026
#84 shipped ControlPath=os.tmpdir()+"sparkdash-%C" through execFile. Two
assumptions were wrong: execFile performs no %-expansion (ssh only expands
%C for shell-parsed configs, not execFile argv), and the socket is created
LOCALLY — on macOS $TMPDIR is a ~60-char per-user path, so the literal
landed at ~120 chars, past the ~104-byte sun_path limit. Every remote
collector died with 'unix_listener: path ... too long' and remote Sparks
rendered offline with a log spam per poll tick.

Fix: compute the same hash OpenSSH uses for %C (sha1 of
localHost:user:remoteHost:port) and hang the socket at /tmp/sparkdash-<hex>
— 60 chars, every platform. Test now asserts the expanded literal's length
and absence of '%' so the template can never regress.

Verified on macOS against a live Spark: before = all collectors erroring,
spark offline; after = online, uptime/GPU/network collected, zero errors,
control socket present at /tmp/sparkdash-9db2... Suite 314/314, frontend
23/23, tsc 0, build green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant