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

Panic in IpfsDHT #7312

Closed
sidenaio opened this issue May 14, 2020 · 4 comments
Closed

Panic in IpfsDHT #7312

sidenaio opened this issue May 14, 2020 · 4 comments
Assignees
Labels
exp/novice Someone with a little familiarity can pick up kind/bug A bug in existing code (including security flaws) P0 Critical: Tackled by core team ASAP status/in-progress In progress
Milestone

Comments

@sidenaio
Copy link

Version information:

github.com/ipfs/go-ipfs v0.5.1-0.20200506014919-3339ce3b0e95

Description:

panic: send on closed channel

goroutine 2038717 [running]:
github.com/libp2p/go-libp2p-kad-dht.(*IpfsDHT).findProvidersAsyncRoutine.func1(0x21ed620, 0xc00b821000, 0xc0002a96e0, 0x22, 0xc00b2507b0, 0xb765d6, 0x1fd1540, 0xc000b141d8, 0x0)
        /home/mikhail/go/pkg/mod/github.com/libp2p/[email protected]/routing.go:582 +0x6d1
github.com/libp2p/go-libp2p-kad-dht.(*IpfsDHT).runLookupWithFollow
@sidenaio sidenaio added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels May 14, 2020
@aschmahmann
Copy link
Contributor

@sidenaio thanks for the bug report. It looks like there's a cleanup issue when the FindProviders lookup is aborted early. Can you give any other context on what you were doing when you encountered the error?

@sidenaio
Copy link
Author

We are using ipfs as a library in our project. We ran a test with 1k nodes. One node went down with this panic. We use ipfs for unixfs.add, unixfs.get, pin.add, pin.rm. Before the panic, our log contains read operation from ipfs.

@Stebalien
Copy link
Member

This will happen when the context is canceled. The issue is that we:

  1. Run queryFn in a goroutine as the "followup".
  2. Abort early of the context is canceled or the "stop" condition is triggered.

Instead, we should just cancel the query and wait till all the query routines return.

https://github.com/libp2p/go-libp2p-kad-dht/blob/08ab423f2fc5f3c3e3e9452fc2358dbc0610d369/query.go#L131

@Stebalien Stebalien added exp/novice Someone with a little familiarity can pick up P0 Critical: Tackled by core team ASAP status/in-progress In progress and removed need/triage Needs initial labeling and prioritization labels May 22, 2020
@Stebalien Stebalien added this to the go-ipfs 0.6 milestone May 22, 2020
@Stebalien Stebalien mentioned this issue May 26, 2020
77 tasks
@Stebalien
Copy link
Member

Fixed in #7382.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/novice Someone with a little familiarity can pick up kind/bug A bug in existing code (including security flaws) P0 Critical: Tackled by core team ASAP status/in-progress In progress
Projects
None yet
Development

No branches or pull requests

3 participants