-
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
Disconnected context in the identify protocol #1030
Comments
Alternatively and similar to #1031, |
@MichaelMure We shut down the go-libp2p/p2p/host/basic/basic_host.go Line 1003 in 3155ff3
The call to go-libp2p/p2p/protocol/identify/id.go Line 276 in 3155ff3
Let me know if you have concerns otherwise otherwise I can close this. Note: We moved to this pattern as we've run into problems propagating and using contexts for closing services. You can read our discussions here: libp2p/go-libp2p-kbucket#50 (comment) |
Here is what I see: func TestFoo(t *testing.T) {
defer goleak.VerifyNone(t)
ctx, cancel := context.WithCancel(context.Background())
_, err := libp2p.New(ctx,
libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/1234"),
)
require.NoError(t, err)
time.Sleep(10 * time.Second)
cancel()
time.Sleep(10 * time.Second)
}
Leaving aside opencensus and go-log, you can see that Identify and Peerstore are left around. Now admittedly, Also, when actually using
Just saw your edit. I understand now using the rational of using |
@aarshkshah1992 can you take a look at this again? |
@jacobheun Taking a look |
Unfortunately, we haven't finished migrating completely from using the context to the That PR also introduces a change to close the PeerStore. |
@aarshkshah1992 : at the minimum as part of your maintenance week can you either handle this or make it clear what the next steps are please? |
We moved away from using contexts for service shutdown, so I believe this issue has become stale. |
Unless I'm missing something, the identify protocol should inherit from the host's context, which would then ensure that its main loop end when the host is terminated.
At the moment this main loop is left running after the host's context get cancelled.
See https://github.com/libp2p/go-libp2p/blob/master/p2p/protocol/identify/id.go#L130
The text was updated successfully, but these errors were encountered: