fix: validate full UniqueAddress in Artery system message ACK/NACK handling#3175
Merged
Conversation
…ndling Motivation: SystemMessageDelivery.notify() only compared the Address portion of incoming ACK/NACK messages, ignoring the UID. When a remote node restarts and obtains a new UID, a delayed ACK from the previous incarnation (same address, different UID) could pass the check and incorrectly clear the unacknowledged buffer, causing system messages to be silently dropped. Modification: Add isFromCurrentRemote() helper that checks the full UniqueAddress (address + UID) against the association's known uniqueRemoteAddress. Falls back to address-only matching when uniqueRemoteAddress is not yet established (pre-handshake), preserving existing behavior. Result: Stale ACKs from previous remote incarnations are rejected, preventing incorrect removal of system messages from the resend buffer. Tests: - sbt "remote / Test / testOnly org.apache.pekko.remote.artery.SystemMessageDeliverySpec" — all 9 tests pass References: Fixes #3174, Refs #3160
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a stale-ACK hazard in Artery’s SystemMessageDelivery by validating ACK/NACK senders against the full UniqueAddress (address + UID), preventing delayed replies from a previous remote incarnation from incorrectly clearing the resend buffer.
Changes:
- Add
isFromCurrentRemote()to gate ACK/NACK handling on the association’s currentuniqueRemoteAddress(with an address-only fallback before handshake completion). - Update
notify()to use the new full-UniqueAddressvalidation for bothAckandNack. - Add a regression test that injects a stale ACK (same address, different UID) and verifies it is ignored and the message is resent.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
remote/src/main/scala/org/apache/pekko/remote/artery/SystemMessageDelivery.scala |
Reject ACK/NACK replies from stale remote incarnations by comparing full UniqueAddress when available. |
remote/src/test/scala/org/apache/pekko/remote/artery/SystemMessageDeliverySpec.scala |
Adds a directional test ensuring a stale-incarnation ACK does not clear the unacknowledged buffer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
SystemMessageDelivery.notify()only compared theAddressportion of incoming ACK/NACK messages, ignoring the UID carried inUniqueAddress. When a remote node restarts and obtains a new UID, a delayed ACK from the previous incarnation (same address, different UID) could pass the check and incorrectly clear the unacknowledged buffer — causing system messages to be silently dropped and never retransmitted.This is the Artery counterpart of the same-class fix already applied to Classic remoting (#3160).
Modification
isFromCurrentRemote()helper that checks the fullUniqueAddress(address + UID) against the association's knownuniqueRemoteAddressuniqueRemoteAddressis not yet established (pre-handshake), preserving existing behaviorResult
Stale ACKs from previous remote incarnations are rejected, preventing incorrect removal of system messages from the resend buffer.
Tests
sbt "remote / Test / testOnly org.apache.pekko.remote.artery.SystemMessageDeliverySpec"— all 9 tests pass (including new"be ignored when ACK is from stale remote incarnation")References
Fixes #3174, Refs #3160