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
Websocket bug: PING to server sends PING Frame instead of PONG Frame #5533
Conversation
…SocketFrameType * added unit test that sends a PING from client to server, and server now returns the correct PONG Frame
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.
Thanks!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5533 +/- ##
============================================
+ Coverage 74.03% 74.05% +0.01%
- Complexity 20854 20871 +17
============================================
Files 1807 1808 +1
Lines 76754 76808 +54
Branches 9790 9800 +10
============================================
+ Hits 56827 56877 +50
+ Misses 15301 15295 -6
- Partials 4626 4636 +10 ☔ View full report in Codecov by Sentry. |
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.
Oops... Nice catch! 🙇♂️🙇♂️
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.
👍 👍 👍
Motivation:
There is a bug in the Websocket Server PING/PONG handing. When a PING message is sent to Server, the Server incorrectly sends out another PING message as a reply. This is because the code to create the PONG message has a bug in it. The problem is that when testing the PING/PONG mechanism, the Server incorrectly send a PING as a reply for a PING. And this caused whoever was sending the initial PING to receive an incorrect reply to the PING. This was only happening for the case when the PING message has data.
Modifications:
com.linecorp.armeria.common.websocket.WebSocketFrame#ofPong(byte[])
, there is the bug. I modified the code to return the correct Frame. See the files changed.Result:
BEFORE:
AFTER: