Ignore stale classic remoting reader ACKs#3173
Open
He-Pin wants to merge 1 commit into
Open
Conversation
Motivation: Classic remoting ACKs forwarded by EndpointReader were not tied to the reader UID, so a delayed ACK from an old reader could affect the resend buffer after a new UID was confirmed. Modification: Tag decoded ACKs with the EndpointReader UID and have ReliableDeliverySupervisor only process ACKs from the currently confirmed UID. Add a supervisor-level regression test covering stale and current reader ACKs. Result: Stale reader ACKs are ignored while current-reader ACKs still acknowledge the active resend buffer. Tests: - sbt "remote / Test / testOnly org.apache.pekko.remote.ReliableDeliverySupervisorSpec" - sbt headerCreateAll - sbt +headerCheckAll - scalafmt --mode diff-ref=origin/main - scalafmt --list --mode diff-ref=origin/main - git diff --check - qodercli -p --output-format stream-json --attachment /tmp/pekko-3160-qoder-review.diff (No must-fix findings) - sbt sortImports (failed: scalafix/scala.meta NoSuchMethodError in stream-tests and multi-node-testkit) References: Fixes apache#3160
4a9b2ec to
2d6a120
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a classic remoting reliability gap where delayed ACKs decoded by an old EndpointReader instance (stale UID) could incorrectly affect the current resend buffer after a new UID is confirmed. It does so by tagging decoded ACKs with the reader UID and only processing ACKs that match the currently confirmed UID, with a focused regression test to prevent reintroductions.
Changes:
- Introduce
ReliableDeliverySupervisor.AckFromReader(readerUid, ack)and ignore untaggedAckmessages in the supervisor. - Update
EndpointReader(both normal andnotReadingmodes) to forwardAckFromReader(uid, ack)instead of a bareAck. - Add a deterministic regression spec verifying stale-reader ACKs are ignored while current-reader ACKs still advance the resend buffer.
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/Endpoint.scala | Tags forwarded ACKs with EndpointReader UID and gates ACK processing in ReliableDeliverySupervisor to the confirmed UID. |
| remote/src/test/scala/org/apache/pekko/remote/ReliableDeliverySupervisorSpec.scala | Adds regression coverage for ignoring stale-reader ACKs and accepting current-reader ACKs. |
💡 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
Classic remoting ACKs forwarded by EndpointReader were not tied to the reader UID, so a delayed ACK from an old reader could affect the resend buffer after a new UID was confirmed.
Modification
Tag decoded ACKs with the EndpointReader UID and have ReliableDeliverySupervisor only process ACKs from the currently confirmed UID.
Add a deterministic supervisor-level regression test covering stale and current reader ACKs. This keeps the regression focused on the actor/UID contract rather than relying on multi-node timing races.
Result
Stale reader ACKs are ignored while current-reader ACKs still acknowledge the active resend buffer.
Tests
References
Fixes #3160