fix(daemon): timeout WebSocket serial opens - #983
Conversation
Wrap the WebSocket serial attach open_port await in the same 30s hard deadline used by the HTTP monitor paths so a wedged USB driver cannot leave pending_serial_attaches stuck. Add regression coverage with an injected hung open future to prove the timeout error and pending attach guard cleanup. Closes #977
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a ChangesWebSocket serial open_port timeout
Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant WebSocketHandler
participant SerialManager
Client->>WebSocketHandler: Attach message
WebSocketHandler->>SerialManager: open_port(port, baud, client_id) with 30s timeout
alt open_port completes
SerialManager-->>WebSocketHandler: Ok/Err result
else timeout elapses
SerialManager-->>WebSocketHandler: (no response)
WebSocketHandler-->>Client: SerialServerMessage::Error (timeout)
end
WebSocketHandler->>WebSocketHandler: drop pending-attach guard
Related issues: Suggested labels: daemon, websockets, timeout Suggested reviewers: none identified 🐰 A timer ticks while ports awaken slow, ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Summary
open_port(...)in a 30 second timeout matching HTTP monitor/deploy monitor behaviorCloses #977
Verification
soldr --no-cache cargo test --target-dir target-codex-977-nocache -p fbuild-daemon --no-default-features handlers::websockets -j 2(captured pass: 8 passed)soldr --no-cache cargo check --target-dir target-codex-977-nocache -p fbuild-daemon --no-default-features -j 2soldr cargo fmt --all --checkgit diff --checkNote: after the captured focused test pass, I made a readability-only cleanup in the test helper and re-ran
soldr cargo fmt --all --checkplusgit diff --check; repeated no-cache/cached test capture attempts after that cleanup exceeded the local tool timeout while compiling or left orphaned Cargo wrappers, so I stopped the orphaned verification process tree.Summary by CodeRabbit
Bug Fixes
Tests