-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(phoenix-channel): fail on missing heartbeat after 5s #4296
feat(phoenix-channel): fail on missing heartbeat after 5s #4296
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Terraform Cloud Plan Output
|
Performance Test ResultsTCP
UDP
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change description LGTM, but I'll defer to @conectado and @ReactorScram for the Rust changes.
"erroneously reset the heartbeat state on all sorts of empty replies, not just the specific one from the heartbeat." Meaning we would not send our heartbeat, and the peer would disconnect since we weren't sending anything? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just phoenix-channel seems to need a hearbeat only if there were no other messages: https://github.com/phoenixframework/phoenix/blob/main/guides/howto/writing_a_channels_client.md?plain=1#L57
interval.set_missed_tick_behavior(MissedTickBehavior::Skip); | ||
let next_id = self | ||
.next_request_id | ||
.fetch_add(1, std::sync::atomic::Ordering::SeqCst); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have an atomic value here? Since you already have &mut self
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I wanted the
No, I think the resulting behaviour was that we would not detect missed heartbeats because the state was cleared too early. Not fatal I think because any reply basically fulfills the role of the heartbeat but it is semantically still incorrect. |
This was introduced in #4296 and I'm guessing it shouldn't be there because we are standardized on `tracing::*` and this goes straight to stderr, can't be filtered out, etc.
This PR fixes a bug and adds a missing feature to
phoenix-channel
.With this PR, we correct the first bug and add a dedicated timeout of 5s for the heartbeat reply.