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

fix: calling message queue Shutdown twice causes panic #414

Merged
merged 1 commit into from
Mar 21, 2023
Merged

Conversation

dirkmc
Copy link
Collaborator

@dirkmc dirkmc commented Mar 21, 2023

The panic is caused because close is called twice on the done channel

This can occur now because a new code path to calling Shutdown was introduced in #412

An example:

panic: close of closed channel

goroutine 9631156 [running]:
github.com/ipfs/go-graphsync/messagequeue.(*MessageQueue).Shutdown(0xc000cc74c8?)
        /home/stuart/go/pkg/mod/github.com/ipfs/go-graphsync@v0.13.3/messagequeue/messagequeue.go:147 +0x1d
github.com/ipfs/go-graphsync/peermanager.(*PeerManager).Disconnected(0xc000cc74c0, {0xc0101003c0, 0x26})
        /home/stuart/go/pkg/mod/github.com/ipfs/go-graphsync@v0.13.3/peermanager/peermanager.go:82 +0xce
github.com/ipfs/go-graphsync/impl.(*graphSyncReceiver).Disconnected(0xc0021e5380?, {0xc0101003c0?, 0x18f2880?})
        /home/stuart/go/pkg/mod/github.com/ipfs/go-graphsync@v0.13.3/impl/graphsync.go:515 +0x28
github.com/ipfs/go-graphsync/network.(*libp2pGraphSyncNotifee).Disconnected(0xc0001ecfb8?, {0x4402b00?, 0xc0001ecf78?}, {0x5a3ca80?, 0xc02621e480?})
        /home/stuart/go/pkg/mod/github.com/ipfs/go-graphsync@v0.13.3/network/libp2p_impl.go:277 +0x58
github.com/libp2p/go-libp2p/p2p/net/swarm.(*Conn).doClose.func1.1({0x5a28810?, 0xc0008290e0?})
        /home/stuart/go/pkg/mod/github.com/libp2p/go-libp2p@v0.23.4/p2p/net/swarm/swarm_conn.go:86 +0x3d
github.com/libp2p/go-libp2p/p2p/net/swarm.(*Swarm).notifyAll(0xc000908340, 0xc01b49bfb8)
        /home/stuart/go/pkg/mod/github.com/libp2p/go-libp2p@v0.23.4/p2p/net/swarm/swarm.go:573 +0xa2
github.com/libp2p/go-libp2p/p2p/net/swarm.(*Conn).doClose.func1()
        /home/stuart/go/pkg/mod/github.com/libp2p/go-libp2p@v0.23.4/p2p/net/swarm/swarm_conn.go:85 +0xa8
created by github.com/libp2p/go-libp2p/p2p/net/swarm.(*Conn).doClose
        /home/stuart/go/pkg/mod/github.com/libp2p/go-libp2p@v0.23.4/p2p/net/swarm/swarm_conn.go:80 +0x18b

@dirkmc dirkmc merged commit 975c0f7 into main Mar 21, 2023
@dirkmc dirkmc deleted the fix/mq-shutdown branch March 21, 2023 08:47
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.

2 participants