Skip to content

fix(proto): drop handshake keys when path 0 was already discarded - #6

Merged
CommaBot merged 2 commits into
stillfail-v1.3from
fix/discard-space-path-zero
Nov 26, 2026
Merged

CommaBot merged 2 commits into
stillfail-v1.3from
fix/discard-space-path-zero

Conversation

@CommaBot

Copy link
Copy Markdown
Collaborator

Problem

On 2026-11-26 10:23:20 UTC, the still.fail mesh front on the mm2 station aborted with signal 6:

panicked at noq-proto/src/connection/mod.rs:4292:14:
PathId::ZERO is alive while Initial/Handshake spaces exist
panicked at noq-1.3.0/src/mutex.rs:138:42:
called `Result::unwrap()` on an `Err` value: PoisonError { .. }
panic in a destructor during cleanup
thread caused non-unwinding panic. aborting.

The front had run for about 3 days. Every device connection to that station dropped. Upstream has the same report and no fix yet: n0-computer#904.

discard_space expects path 0 to exist when it drops the Initial or Handshake keys. Path 0 can be abandoned and discarded before the handshake is confirmed: a replacement path took over (this fork also abandons an idle last-open path once a replacement validates, 4b0448dd), or the peer sent PATH_ABANDON for it.

Change

  • discard_space: if path 0 is gone, still drop the keys and the sent packets. Skip only the in-flight and loss-timer update of the discarded path (PathDrained already stopped its timers).
  • inner_on_ack_received: a discarded path 0 keeps its Initial and Handshake number spaces until those are dropped. A late ACK in them reached path_data(PathId::ZERO) and panicked the same way. Such an ACK is now ignored, as an ACK on any other discarded path is.
  • Test-only hooks (#[cfg(test)]) let the test drive the exact state: path 0 abandoned and discarded while the client still holds its Handshake keys.

Tests

  • New test: tests::multipath::handshake_keys_dropped_after_path_zero_discarded.
    • With only the discard_space fix reverted, it panics with PathId::ZERO is alive while Initial/Handshake spaces exist.
    • With only the ACK fix reverted, it panics with unknown path: 0.
    • With both fixes, it passes.
  • cargo test -p noq-proto --lib: 443 passed.
  • cargo clippy -p noq-proto --all-targets adds no warnings. cargo fmt --check reports nothing in the changed lines.

Model: Claude Opus 5.5. Test framework: cargo test.

🤖 Generated with Claude Code

still.fail station and others added 2 commits November 26, 2026 19:50
`discard_space` expected path 0 to exist when it drops the Initial or
Handshake keys. Path 0 can be abandoned and discarded before the
handshake is confirmed: a replacement path took over, or the peer sent
PATH_ABANDON for it. The `expect` then panicked, the panic poisoned the
connection mutex, and a later `Drop` that locked it panicked again
inside cleanup, which aborted the process (n0-computer#904).

Now `discard_space` still drops the keys and the sent packets, and
skips only the in-flight and loss-timer update of the discarded path.

A discarded path 0 also keeps its Initial and Handshake number spaces
until those are dropped, so a late ACK in them reached `path_data` for
a path that no longer exists, and panicked the same way. Such an ACK
is now ignored, as an ACK on any other discarded path is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CommaBot
CommaBot merged commit ec345e7 into stillfail-v1.3 Nov 26, 2026
3 checks passed
CommaBot pushed a commit to AFK-surf/monoid that referenced this pull request Nov 26, 2026
…front

The front on mm2 aborted on 2026-11-26 at 10:23:20 UTC after about
3 days up, and every device connection to it dropped. noq-proto's
`discard_space` expected path 0 to exist when it dropped the Handshake
keys. Path 0 can be abandoned and discarded before the handshake is
confirmed, so the `expect` panicked. The panic poisoned the connection
mutex, and a `Drop` that locked it panicked again in cleanup, which
aborted the process (n0-computer/noq#904).

zzj3720/noq#6 (ec345e7) fixes `discard_space`, and also ignores a late
Initial or Handshake ACK on a discarded path 0, which panicked the same
way in `path_data`.

The front's STREAMS stays at 8. A bump would restart every station's
front once, and drop every device, to fix a crash seen once in 3 days.
A front starts from the new release whenever it starts next.

Changelog: 修复:station 的网络前端在多路径握手时偶发崩溃、所有设备一起断线的问题
Changelog-parts: station, android, desktop

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CommaBot pushed a commit to AFK-surf/monoid that referenced this pull request Nov 26, 2026
…front

The front on mm2 aborted on 2026-11-26 at 10:23:20 UTC after about
3 days up, and every device connection to it dropped. noq-proto's
`discard_space` expected path 0 to exist when it dropped the Handshake
keys. Path 0 can be abandoned and discarded before the handshake is
confirmed, so the `expect` panicked. The panic poisoned the connection
mutex, and a `Drop` that locked it panicked again in cleanup, which
aborted the process (n0-computer/noq#904).

zzj3720/noq#6 (ec345e7) fixes `discard_space`, and also ignores a late
Initial or Handshake ACK on a discarded path 0, which panicked the same
way in `path_data`.

The front's STREAMS stays at 8. A bump would restart every station's
front once, and drop every device, to fix a crash seen once in 3 days.
A front starts from the new release whenever it starts next.

Changelog: 修复:station 的网络前端在多路径握手时偶发崩溃、所有设备一起断线的问题
Changelog-parts: station, android, desktop

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CommaBot added a commit to AFK-surf/monoid that referenced this pull request Nov 26, 2026
…front (#8847)

The front on mm2 aborted on 2026-11-26 at 10:23:20 UTC after about
3 days up, and every device connection to it dropped. noq-proto's
`discard_space` expected path 0 to exist when it dropped the Handshake
keys. Path 0 can be abandoned and discarded before the handshake is
confirmed, so the `expect` panicked. The panic poisoned the connection
mutex, and a `Drop` that locked it panicked again in cleanup, which
aborted the process (n0-computer/noq#904).

zzj3720/noq#6 (ec345e7) fixes `discard_space`, and also ignores a late
Initial or Handshake ACK on a discarded path 0, which panicked the same
way in `path_data`.

The front's STREAMS stays at 8. A bump would restart every station's
front once, and drop every device, to fix a crash seen once in 3 days.
A front starts from the new release whenever it starts next.

Changelog: 修复:station 的网络前端在多路径握手时偶发崩溃、所有设备一起断线的问题
Changelog-parts: station, android, desktop

Co-authored-by: 3720 <zuozijian1994@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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