Skip to content

fix: validate full UniqueAddress in Artery system message ACK/NACK handling#3175

Merged
He-Pin merged 1 commit into
mainfrom
fix-3174-artery-stale-ack
Jun 24, 2026
Merged

fix: validate full UniqueAddress in Artery system message ACK/NACK handling#3175
He-Pin merged 1 commit into
mainfrom
fix-3174-artery-stale-ack

Conversation

@He-Pin

@He-Pin He-Pin commented Jun 24, 2026

Copy link
Copy Markdown
Member

Motivation

SystemMessageDelivery.notify() only compared the Address portion of incoming ACK/NACK messages, ignoring the UID carried in UniqueAddress. 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

  • 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
  • Add directional test that injects a stale ACK from a previous incarnation and verifies it is rejected

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 (including new "be ignored when ACK is from stale remote incarnation")

References

Fixes #3174, Refs #3160

…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
@He-Pin He-Pin marked this pull request as draft June 24, 2026 19:08
@He-Pin He-Pin requested a review from Copilot June 24, 2026 19:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 current uniqueRemoteAddress (with an address-only fallback before handshake completion).
  • Update notify() to use the new full-UniqueAddress validation for both Ack and Nack.
  • 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.

@He-Pin He-Pin marked this pull request as ready for review June 24, 2026 19:16

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@pjfanning pjfanning added this to the 2.0.0-M4 milestone Jun 24, 2026
@He-Pin He-Pin merged commit 07a346c into main Jun 24, 2026
10 checks passed
@He-Pin He-Pin deleted the fix-3174-artery-stale-ack branch June 24, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Artery system message delivery should ignore ACKs from stale remote UIDs

3 participants