-
Notifications
You must be signed in to change notification settings - Fork 2.2k
peer: introduce super priority send queue for pings+pongs #9797
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
Conversation
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This commit introduces a new "super priority" send queue to the peer's `writeHandler`. This queue is designed for messages that must bypass the regular send queue to ensure timely delivery, such as ping messages. Previously, ping messages were sent via the regular `sendQueue`. If this queue was backed up with other messages (e.g., channel updates, HTLC settlements), pings could be delayed. This delay could lead to the ping-pong mechanism incorrectly determining that the peer is unresponsive, resulting in a premature disconnection. The new `superPrioSendQueue` is checked before the regular `sendQueue` in the `writeHandler`. If a message is sent from the super priority queue, the `writeHandler` will immediately loop back to check this queue again, ensuring it is drained before processing messages from the regular queue. Ping and pongs messages are now sent using this super priority queue via the new `SendSuperPriorityMessage` method. This helps prevent unnecessary disconnections due to delayed pings when the peer is otherwise busy processing other messages. The `superPrioSendQueue` is a buffered channel of size 2 (able to queue a ping and a pong non-blocking).
Given that the culprit was the readHandler rather than the sending of the Ping msg I think we don't need this one. |
Yep, may be something we want to look into in the future, re certain messages just bypassing the queue all together. |
This commit introduces a new "super priority" send queue to the peer's
writeHandler
. This queue is designed for messages that must bypass the regular send queue to ensure timely delivery, such as ping messages.Previously, ping messages were sent via the regular
sendQueue
. If this queue was backed up with other messages (e.g., channel updates, HTLC settlements), pings could be delayed. This delay could lead to the ping-pong mechanism incorrectly determining that the peer is unresponsive, resulting in a premature disconnection.The new
superPrioSendQueue
is checked before the regularsendQueue
in thewriteHandler
. If a message is sent from the super priority queue, thewriteHandler
will immediately loop back to check this queue again, ensuring it is drained before processing messages from the regular queue.Ping and pongs messages are now sent using this super priority queue via the new
SendSuperPriorityMessage
method. This helps prevent unnecessary disconnections due to delayed pings when the peer is otherwise busy processing other messages.The
superPrioSendQueue
is a buffered channel of size 2 (able to queue a ping and a pong non-blocking).