Skip to content

fix(ssh): stop a stale log sink failure from clearing its successor - #15

Open
andreas-byfut wants to merge 1 commit into
LordOfPolls:masterfrom
andreas-byfut:fix/ssh-log-sink-race
Open

andreas-byfut wants to merge 1 commit into
LordOfPolls:masterfrom
andreas-byfut:fix/ssh-log-sink-race

Conversation

@andreas-byfut

Copy link
Copy Markdown
Contributor

A session log sink reports write failures on the reader thread. It used to clear logSink and
isLogging unconditionally. If logging had been restarted in the meantime, the late callback
dropped the new sink, so the new log lost its output while the UI showed logging as off.

  • Changes to logSink and isLogging now happen under one lock, and a failure detaches only the
    sink that reported it.
  • "Writing the session log failed - logging stopped." now appears only when the failing sink was
    still the current one.

Known limits:

  • A failure in the async close of a log the user already stopped is no longer shown.
  • There is no unit test, because SshConnection builds its own SSHClient and has no seam for
    one.

A SessionLogSink's failure callback ran on the reader thread and
unconditionally cleared logSink and isLogging. If logging had been
restarted meanwhile, the late callback dropped the new sink, so the new
log silently lost its output while the UI showed logging off.

Changes to logSink and isLogging now happen under one lock, and a
failure only detaches the sink that reported it. The caller's onFailure
fires only when that sink was still the current one, so a stale failure
no longer reports "logging stopped" while logging is running.
@LordOfPolls

Copy link
Copy Markdown
Owner

Hey. Looks like a good change, however please can you make 2 revisions.

I believe that a sink that has been stopped or replaced now fails silently. It only flushges on close, so if for whatever reason it cant write (ie, disk filled, storage revoked) logged loses the end of the log. Would suggest keeping the toast notif

Please adda a test. SshConnection builds in JVM (see FakeSshConnection).

@LordOfPolls LordOfPolls added bug Something isn't working needs-revision labels Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working needs-revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants