Skip to content

id(ssh): PR #594's dropped-input notice can never fire in-session — the shell reads a snapshot taken before the queue exists, and the handler's counter is never read again #602

Closed

Description

@dezren39

Finding

PR #594 (OPEN, head 090c356b52a9e1c852692785cee2d0af3e03eef1) claims dropped SSH input is "no longer silent" (#549): the shell should show the viewer a notice before the next frame. As wired, the notice can never fire for drops that happen during a session — the only counter the shell reads is a snapshot taken before the input queue exists, when its value is necessarily 0. Only the tracing::warn! log line works.

Evidence (pkgs/id/src/world_ssh.rs on the PR head)

  • The russh data() handler (:363-388) counts refused bytes on the handler struct: self.dropped_input += data.len(); on TrySendError::Full. It also early-returns when self.input is None (:368-370), and self.input is only set inside shell_request — so no drop can ever be counted before the shell opens.
  • shell_request constructs SshIo with a copy: dropped_input: self.dropped_input (:344) — at that moment necessarily 0, per the point above.
  • After that, nothing ever updates SshIo.dropped_input. note_dropped_input() (:455-460), called at the top of send(), reads only the SshIo copy, which stays 0 for the life of the session, so dropped_input_notice() always returns None and pending_notice is never set. Drops that happen under load mid-session increment the handler's counter, which is never read again (grep over the full file at the head SHA: the handler counter is written at :379/logged at :383 and read only at the :344 snapshot).
  • Related dead wiring in the same diff: INPUT_DROP_NOTICE_BYTES: usize = 1024 (:52, "Input bytes dropped before the session tells the viewer about it") is defined and never referenced; dropped_input_notice() fires at bytes > 0 instead, so the intended thresholding was never connected either.

Why it matters

#549's user-visible half — a viewer whose keystrokes are being refused under load is told so — silently does nothing, while the PR description and its unit test (dropped_input_notice_counts_and_quiet_zero, which only exercises the pure formatting helper) make it look delivered. The first sign in production would be the same "my input vanished" reports #549 was filed for.

Acceptance criteria

  • The drop count is shared between the russh handler and the session I/O (e.g. an Arc<AtomicUsize> or an equivalent channel), so bytes refused after the shell opens reach the shell.
  • A test that actually fills the input queue during a live session (or drives the shared counter the same way the handler does) observes the [-- input dropped: N bytes ... --] notice on the channel before the next frame.
  • The notice threshold is one coherent rule: either INPUT_DROP_NOTICE_BYTES is used as documented or the constant is removed.
  • The counter resets only after the notice has actually been handed to the viewer, so drops are neither double-counted nor lost between frames.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions