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.
Fixed circular reference issues preventing DuplexSockets from being cleaned up correctly.
Motivation:
I found two separate circular references while working on an application.
The DuplexSocket created a task which was cleaning up abort handles for RequestResposne Responders. The problem was this task kept a clone of the duplex socket, including the Tx channel that the channel used. Since the Tx end of the channel was being held by the task that also held the RX end of the channel, this task would never shut down, and none of the other contents of the DuplexSocket would be dropped either
When a user saved the RSocket provided to the on_setup acceptor, this caused an issue when the remote disconnected. The read tasks for the socket would complete, but the write tasks would keep the socket open for a time. The write tasks couldn't expire because a reference to DuplexSocket was kept within the RSocket provided to the user.
Modifications:
Finally, there were a few places where I turned async functions into non-async functions.
Result:
This should prevent issues where some of the underling tasks remain running indefinitely on disconnection, and prevent possible reference cycles from being created inadvertently.