Repository navigation
Conversation
Motivation: Outbound stream consumers sometimes need to know when the underlying transport has finished, not just when the stream has stopped. The two events can occur in a different order. Modification: Reuse the existing TCP flow and worker for an already resolved peer, with a separate opt-in cleanup receipt. Order the receipt on the owning selector after submitted registration and close work, and do not confirm cleanup while the channel is open or still registered. Keep the original outgoing APIs and default behavior. Result: Internal consumers can distinguish a never-started dial or confirmed cleanup from graph completion and uncertain transport termination. No Pekko HTTP dependency or minimum-version change is included. Tests: The exact modified actor and stream sources compiled with JDK 17 on Scala 2.13.18 and 3.3.9, and SelectorCleanupOrderingSpec passed (1/1) on each. The fixture models the queue ordering without opening sockets. Scoped scalafmt, diff checks, and existing JVM descriptor checks passed. Full sbt and socket integration suites were not run. References: Java SelectableChannel.isRegistered; RFC 6455 §4.1 (consumer context).
He-Pin
marked this pull request as ready for review
November 27, 2026 22:42
He-Pin
marked this pull request as draft
November 27, 2026 22:46
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
An outgoing TCP stream can finish before its underlying channel has completed cleanup. An internal consumer coordinating subsequent work needs a separate receipt; actor or graph termination does not establish when the owning selector deregistered the channel.
Modification
Result
The ordinary TCP path and Pekko HTTP dependency requirements are unchanged. Consumers may opt into the more precise receipt without adding another TCP wrapper.
Tests
SelectorCleanupOrderingSpecpassed (1/1 each).git diff --check, and existing descriptor comparison for the affected TCP APIs passed.References
SelectableChannel.isRegistered