Skip to content

fix(streamer): carry stop causes and transport state into stream failure reports - #1110

Merged
capy-ai[bot] merged 1 commit into
devfrom
capy/carry-stop-causes-and
Oct 5, 2026
Merged

capy-ai[bot] merged 1 commit into
devfrom
capy/carry-stop-causes-and

Conversation

@zortos293

Copy link
Copy Markdown
Collaborator

This adds diagnostics only, so stream behaviour is unchanged. Five OpenNOW Reports issues from nightly 866 were triaged as "needs info" because the logs couldn't separate the possible causes. This PR records the missing evidence and carries it into the messages the shell already reports. All error codes stay the same, so the reports backend keeps grouping these issues as it does now.

What the current logs show

  • nvst_recovery_exhausted (iss_01M44ECWXPR3YJERYFSND0VGYC, 7 players). Ingress stopped at the socket on both legs.
    • In br-3D195A, video inbound=47836 and bundle inbound=32010 don't change between …964 and …974. Bundle outbound stops too, while hole-punch pings keep rising. br-1597E8 and br-84511F show the same pattern.
    • In all three, input-unavailable is logged about 2.1 s after the last video packet, but its reason is dropped. Channel closes and bundle state aren't logged at all.
    • So the logs can't tell a server-side SCTP close from a local teardown after silence.
  • nvst_transport_stopped (iss_01M44QKTG063187MRM5M1PZWTA). All 23 worker receiver.stop() sites end in the same Lifecycle(Stopped) event. Most of them only eprintln their error, so it never reaches the file log. In br-A40C8D, input-unavailable and the stop share a millisecond, with no nvst-udp error.
  • webrtc_signaling_failed (iss_01M45GXWMC45NWQW2KXJKN7D9H). "Signaling connection closed" comes from a catch-all Err(_) branch that discards the tungstenite error.
  • media_consumer_closed (iss_01M44GPF7EM3P8MXZ6B7ZPTSXY). A media-decode-error comes about 600 ms before the closure. The core reporter sends only one report per kind and code per run, so the decoder error's text never reached any report.

Change

  • Typed stop cause (NvstStopCause). Every stop site now passes a cause: requested, controller closed, upstream gate closed, media consumer closed, input delivery failed, HID output blocked, randomness unavailable, Socket{operation, kind, os_code}, or WebRtc{operation, category}. The terminal message becomes, for example, NVST receiver stopped unexpectedly (cause=socket operation=bundle-receive kind=ConnectionReset os_code=10054), and the code stays nvst-transport-stopped.

  • Input-unavailable reason. It is now logged. The reason is restricted to compile-time &'static str reasons, so nothing else can reach that line.

  • Bundle liveness (BundleLiveness). It tracks idle ages for any inbound datagram, peer inbound, outbound transmit and SCTP data, plus the last ICE state, the ICMP-unreachable count and the closed-channel count. It is logged:

    • at each SCTP channel close, which is bounded by the channel count;
    • on each Recover command;
    • once on Stop.

    The video media-timeout line gains rx_idle_ms and port_unreachable.

    • What this answers: peer_rx_idle_ms≈0 at channel close means the server closed SCTP, and ≈2000+ means a local teardown after silence.
    • Per-packet cost: none extra. The timestamp reuses the existing post-receive now.
  • Signaling failures now append the I/O kind and OS code, the tungstenite protocol variant, the HTTP status or tls, the peer close code, or peerRemoved/BYE. Server close-reason text, URLs and addresses are never included.

  • Media consumer closed. The core remembers the last video decoder error, capped at 240 characters. It appends it as …closed after H264 decoder error: <msg>.

  • Docs. docs/streamer-comparison/windows-udp-diagnostics.md documents every new field.

Verification

  • cargo test --workspace (native/opennow-streamer): 1048 passed.
  • cargo fmt --all --check and clippy on the transport and core crates: clean.
  • New tests cover:
    • stop-cause formatting, with no addresses in the output;
    • the bundle snapshot format;
    • the stop cause reaching nvst-transport-stopped;
    • the decoder error carried into the closure message, including truncation;
    • the input-unavailable reason reaching the file log;
    • signaling details for I/O errors, reset-without-close, write errors and close code 1011.

Not covered

  • webrtc_disconnected (iss_01M44EWWTKKDDJ1W1CN667KFVC): fix(streaming): complete WebRTC startup and default alliance accounts to compatibility mode #1098 already logs ICE, DTLS and traffic stages, and these reports predate it. The next nightly should produce a report with that evidence.
  • Decoder error ordering: the decoder error is attached only if its feedback is processed before the closure event, and that ordering isn't guaranteed.
  • Visible messages: terminal messages the user can see are now more technical, for example (cause=…).
  • Windows: only PR CI builds and runs this on Windows.

Open in Capy

@coderabbitai

coderabbitai Bot commented Oct 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6c67451a-3f68-4d72-8945-d3451551c92d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@capy-ai
capy-ai Bot merged commit 6cef7db into dev Oct 5, 2026
14 checks passed
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