Skip to content
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

Return a closed channel instead of nil for getChannelOrErrorParallel #64

Merged

Conversation

mathew-cf
Copy link
Contributor

@mathew-cf mathew-cf commented Dec 2, 2022

Returning nil causes functions ranging over the channel to block indefinitely but returning a closed channel doesn't. In our specific case, go-bitswap was hanging on it and after a few canceled requests, would no longer reach out to IPFS indexers via go-delegated-routing.

Here's the line that would hang. Discovered via a pprof goroutine dump.
https://github.com/ipfs/go-bitswap/blob/13c89f1ba6c65253a3dfc3b2bafcb1730b320b66/network/ipfs_impl.go#L382

Thanks @Anshul-Birla for extensive help with debugging this.

@ajnavarro
Copy link
Member

Thanks for the catch and the fix! FindProvidersAsync looks like the only method using getChannelOrErrorParallel and ignoring the error output... We will merge this and fix the bug upstream ASAP.

@ajnavarro ajnavarro merged commit 3c44e30 into libp2p:master Dec 2, 2022
@BigLep
Copy link

BigLep commented Dec 2, 2022

Can we add a regression test here proving this now addresses the observed behavior?

@ajnavarro
Copy link
Member

@BigLep added here thanks to @guseggert #66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants