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

p2p/discv5: fix topic register panic at shutdown #15946

Merged
merged 1 commit into from
Jan 23, 2018

Conversation

zsfelfoldi
Copy link
Contributor

@zsfelfoldi zsfelfoldi commented Jan 23, 2018

This PR fixes a panic in nextFilteredTicket that was caused by removeRegisterTopic removing a topic from s.tickets and then nextRegisterableTicket() still returning s.nextTicketCached that referred to that topic.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x9b3208]

goroutine 91 [running]:
github.com/ethereum/go-ethereum/p2p/discv5.(*ticketStore).nextFilteredTicket(0xc42045e460, 0xc44bb7e360, 0xc44bb7e360)
	/home/fefe/go/src/github.com/ethereum/go-ethereum/p2p/discv5/ticket.go:353 +0x228
github.com/ethereum/go-ethereum/p2p/discv5.(*Network).loop.func2()
	/home/fefe/go/src/github.com/ethereum/go-ethereum/p2p/discv5/net.go:383 +0x50
github.com/ethereum/go-ethereum/p2p/discv5.(*Network).loop(0xc423b10200)
	/home/fefe/go/src/github.com/ethereum/go-ethereum/p2p/discv5/net.go:414 +0x354
created by github.com/ethereum/go-ethereum/p2p/discv5.newNetwork
	/home/fefe/go/src/github.com/ethereum/go-ethereum/p2p/discv5/net.go:169 +0x82b

@zsfelfoldi zsfelfoldi requested a review from fjl as a code owner January 23, 2018 00:37
Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd really like to know what goes wrong here and why? Instead of fixing the panic by adding an extra check, I'd like to know why we get to an inconsistent state where the returned topics is invalid.

@zsfelfoldi
Copy link
Contributor Author

@karalabe done

Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@karalabe karalabe merged commit 397c6cd into ethereum:master Jan 23, 2018
@karalabe karalabe added this to the 1.8.0 milestone Jan 23, 2018
prestonvanloon pushed a commit to prestonvanloon/go-ethereum that referenced this pull request Apr 2, 2018
mariameda pushed a commit to NiluPlatform/go-nilu that referenced this pull request Aug 23, 2018
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