-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Close resource manager when host closes #1343
Conversation
When a host is closed, it should close its resource manager. Otherwise, goroutines are leaked. Generally this is not a problem when a host exists for the life of a program, but can be a problem if hosts are created and closed.
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.
wait,no, there is a reason we havent done this. It is not necessary the case that we own the rcmgr; it could be shared between hosts in the app.
We can only safely close the default instantiation.
whoops, sorry for the fast approval, i mistakenly thought this PR was up a level in application logic |
no problem, we do want to close the default instantiation to avoid the
goroutine leak. If you can rework this to track that case, it would be
great.
Otherwise we'll sort it out with marten.
…On Tue, Feb 22, 2022, 20:00 Will ***@***.***> wrote:
whoops, sorry for the fast approval, i mistakenly thought this PR was up a
level in application logic
—
Reply to this email directly, view it on GitHub
<#1343 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAI4SQQW3GXQRDG23NLADTU4PFLTANCNFSM5PCBLRIA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@gammazero Are you planning to fix this PR? |
@marten-seemann I will fix it unless you plan to do so this week. Would you prefer an additional option to tell |
I'm going to merge this PR. In fact, we have the same problem with the connection manager, and we also close it when the host closes. |
It is not necessary to explicitly close a libp2p host's resource manager. The problem was fixed in this PR: libp2p/go-libp2p#1343
* Remove code to resolve address before gostream.Dial This code is not needed as the problem was fixed by this PR: libp2p/go-libp2p#1342 * No longer necessary to explicitly close resource manager It is not necessary to explicitly close a libp2p host's resource manager. The problem was fixed in this PR: libp2p/go-libp2p#1343
When a host is closed, it should close its resource manager. Otherwise, goroutines are leaked.
Generally this is not a problem when a host exists for the life of a program, but can be a problem if hosts are created and closed.