remove 2 debug_asserts#3478
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes two debug_assert!s in the extended CONNECT (WebTransport / CONNECT-UDP) session code to avoid debug-build failures in situations where those asserts can be reached (race/state transitions) or where the path should be unreachable.
Changes:
WebTransportSession::write_datagram_capsule()now returnsErr(Error::Unavailable)instead of unconditionallyOk(())with a failingdebug_assert!.Session::send_datagram()no longer fires adebug_assert!(false)when called in a non-Activestate (it already returnsErr(Error::Unavailable)).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| neqo-http3/src/features/extended_connect/webtransport_session.rs | Replace an unconditional failing debug assert in the DATAGRAM capsule path with a concrete error return. |
| neqo-http3/src/features/extended_connect/session.rs | Remove a debug assert in send_datagram() that could trip during non-Active state transitions while preserving the existing error behavior. |
| debug_assert!( | ||
| false, | ||
| "[{self}] WebTransport does not support datagram capsules." | ||
| ); | ||
| Ok(()) | ||
| // WebTransport uses QUIC datagrams, not HTTP DATAGRAM Capsules. | ||
| // datagram_capsule_support() returns false so this should never be called. | ||
| Err(Error::Unavailable) |
There was a problem hiding this comment.
Can you explain how you are hitting this debug_assert?
webtransport::Session::datagram_capsule_support always returns false.
neqo/neqo-http3/src/features/extended_connect/webtransport_session.rs
Lines 402 to 413 in 6978589
Thus webtransport::Session::write_datagram_capsule should enver be called.
neqo/neqo-http3/src/features/extended_connect/session.rs
Lines 449 to 457 in 6978589
There was a problem hiding this comment.
Not hitting it. This shouldn't be possible at the moment, but if some future change (accidentally) changed that, returning an error would be better I think
There was a problem hiding this comment.
but if some future change (accidentally) changed that
In that case it would panic in debug mode, thus alerting us of the bug, and return an error in release mode, thus not causing harm. In other words, please keep this as is.
| qtrace!("[{self}] send_datagram state={:?}", self.state); | ||
| if self.state != State::Active { | ||
| qdebug!("[{self}]: cannot send datagram in {:?} state.", self.state); | ||
| debug_assert!(false); |
…ondition, plus one that should never happen
6978589 to
b5a260e
Compare
761c9f7 to
d9cc0a9
Compare
|
@jesup please see my response above. In addition, I believe you accidentally included unrelated changes in this pull request. |
Remove a debug assert that could cause debug builds to fail in a race condition, plus one that should never happen