Skip to content

Commit

Permalink
refactor: print current StateSignaling variant in debug_assert (#…
Browse files Browse the repository at this point in the history
…1783)

* refactor: print current `StateSignaling` variant in debug_assert

CI paniced in `StateSignaling::handshake_done`. Though failure hasn't been
reproducible locally. To ease debugging future CI failures, print the current
state on panic.

```
thread 'idle_timeout_crazy_rtt' panicked at neqo-transport\src\connection\state.rs:212:13:
StateSignaling must be in Idle state.
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/8df7e723ea729a7f917501cc2d91d640b7021373/library\std\src\panicking.rs:646
   1: core::panicking::panic_fmt
             at /rustc/8df7e723ea729a7f917501cc2d91d640b7021373/library\core\src\panicking.rs:72
   2: enum2$<neqo_transport::connection::state::StateSignaling>::handshake_done
             at .\src\connection\state.rs:212
   3: neqo_transport::connection::Connection::handle_lost_packets
             at .\src\connection\mod.rs:2847
   4: neqo_transport::connection::Connection::process_timer
             at .\src\connection\mod.rs:966
   5: neqo_transport::connection::Connection::process_output
             at .\src\connection\mod.rs:1085
   6: neqo_transport::connection::Connection::process
             at .\src\connection\mod.rs:1108
   7: test_fixture::sim::connection::impl$1::process
             at D:\a\neqo\neqo\test-fixture\src\sim\connection.rs:146
   8: test_fixture::sim::Simulator::process_loop
             at D:\a\neqo\neqo\test-fixture\src\sim\mod.rs:193
   9: test_fixture::sim::ReadySimulator::run
             at D:\a\neqo\neqo\test-fixture\src\sim\mod.rs:284
  10: test_fixture::sim::Simulator::run
             at D:\a\neqo\neqo\test-fixture\src\sim\mod.rs:265
  11: network::idle_timeout_crazy_rtt
             at D:\a\neqo\neqo\test-fixture\src\sim\mod.rs:69
  12: network::idle_timeout_crazy_rtt::closure$0
             at D:\a\neqo\neqo\test-fixture\src\sim\mod.rs:58
  13: core::ops::function::FnOnce::call_once<network::idle_timeout_crazy_rtt::closure_env$0,tuple$<> >
             at /rustc/8df7e723ea729a7f917501cc2d91d640b7021373\library\core\src\ops\function.rs:250
  14: core::ops::function::FnOnce::call_once
             at /rustc/8df7e723ea729a7f917501cc2d91d640b7021373/library\core\src\ops\function.rs:250
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
```

https://github.com/mozilla/neqo/actions/runs/8496770595/job/23274538553

* clippy
  • Loading branch information
mxinden authored Apr 2, 2024
1 parent 27a7250 commit 6860687
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion neqo-transport/src/connection/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ pub enum StateSignaling {
impl StateSignaling {
pub fn handshake_done(&mut self) {
if !matches!(self, Self::Idle) {
debug_assert!(false, "StateSignaling must be in Idle state.");
debug_assert!(
false,
"StateSignaling must be in Idle state but is in {self:?} state.",
);
return;
}
*self = Self::HandshakeDone;
Expand Down

0 comments on commit 6860687

Please sign in to comment.