-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[skip changelog] fix: Drop stream references on Close/Reset #760
Conversation
Thank you for submitting this PR!
Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution. |
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #760 +/- ##
==========================================
+ Coverage 60.43% 60.51% +0.07%
==========================================
Files 245 245
Lines 31102 31126 +24
==========================================
+ Hits 18797 18836 +39
+ Misses 10630 10619 -11
+ Partials 1675 1671 -4
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the motivation for this? I'm not sure streams are Closed/Reset at all much, so maybe that's the real problem.
I am not sure the code needs to be concurrency-safe either. Does it? The messagequeue seems to SendMessage sequentially.
Correct. It's necessary if we use the AfterFunc as in this change (which was a small diff on this): https://github.com/ipfs/boxo/pull/763/files. Let me change this to remove that and move the atomic to that PR. |
@MarcoPolo Thank you. IMO we will want both PRs anyway since it seems like we would want to nil the connection if the context was canceled anyway. That way we have a better chance of reconnecting before using the dead connection instead of getting an error while using it. |
Makes sense. I just tidied up this PR by moving the atomic things to the next PR. |
cc5f567
to
9acb9f9
Compare
Lets connections get GC'd sooner (possibly before the streamMessageSender is GC'd)
refactor: if the conn has a context, use context.AfterFunc for cleanup --------- Co-authored-by: Marco Munizaga <git@marcopolo.io>
9acb9f9
to
af8522d
Compare
Lets connections get GC'd sooner (possibly before the streamMessageSender is GC'd)
There's a small extension to this pr in https://github.com/ipfs/boxo/tree/marco/with-AfterFunc that uses
context.AfterFunc
. But even without that, from my tests, this seems to help as well.