Repository navigation
fix(ssh): a quit that aborts an upload whose read already ended no longer crashes main (BUG-23) - #25922
Merged
Conversation
…nger crashes main (BUG-23) Quitting while an on-connect orcad update was uploading its bundle aborted the connection's teardown signal. sftp-upload's abort handler destroyed the local read stream with the signal's reason, but once that read had ended, 'finished' had already removed its listeners, so the stream emitted an unhandled 'error': [main_uncaught_exception] AbortError: This operation was aborted. Electron's error dialog then blocked the main thread and the app never exited. The read stream now always has a no-op error listener; the transfer's outcome still comes from 'finished'. Both the bare upload and the connection-level teardown abort are covered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Quitting Orca while it was uploading a managed-server update to an SSH host crashed the main process with an "operation was aborted" error. Electron then showed its error dialog and blocked forever, so the app never quit and had to be killed. The upload code now handles that abort quietly, and the quit completes.
What Changed
disconnectAll→SshConnection.disconnect()aborts the connection's teardown signal. sftp-upload's abort handler destroys the local read stream with the signal's reason. When the read had already reached the end of the file and only the remote write was still flushing,finished(readStream, { cleanup: true })had already removed its listeners. Sodestroy(reason)emitted an'error'with no listener, which became[main_uncaught_exception] AbortError: This operation was aborted(BUG-23).'error'listener as soon as it's created. The transfer's outcome is still read fromfinishedand the write side, so a real read failure still fails the upload, and an abort still rejects withAbortError.Why
destroycall: it covers every path that destroys the stream after its read ended, the abort and the final cleanup alike.Linked Issue
BUG-23 (final real-host run). The fence half, where a quit mid-activation leaves a lock the next launch waits up to 20 minutes on, is being coordinated with fix-orcad under #25834's token rules and will follow separately.
Visual Proof
N/A. This is a main-process crash fix.
Testing
sftp-upload: a quit-time abort of an upload whose read already ended raises no uncaught exception. It reproduces the exact
AbortError: This operation was abortedwithout the fix.Connection level:
uploadSshDirectoryaborted through the connection's teardown signal, exactly asdisconnect()does, rejects withAbortErrorand raises no uncaught exception. This also fails without the fix.Local runs:
pnpm tc:nodeand the changed-code gate pass.sftp-upload, the quit test andssh-connection*pass (318).I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)