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

eth: continue after whitelist check #24210

Merged
merged 1 commit into from Jan 7, 2022

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Jan 7, 2022

The whitelist mechanism got broken in #23576, afaict, making it so that if the whitelist check succeeds, the code stalls. The peer is left somehow neither accepted nor rejected, in a state where it's marked as shutting down but not actually kicked out.

This is the cause behind #24202 .
Also, aside from not being able to sync, it also (on my test) causes failure to shut down.

With this fix, I was able to start syncing with peers after the check completes.

@holiman
Copy link
Contributor Author

holiman commented Jan 7, 2022

Also, aside from not being able to sync, it also (on my test) causes failure to shut down.

Without the PR, on shutdown, a lot of peers are stuck on wg.Wait here:

sync.runtime_Semacquire(0xc0055fc150)
	runtime/sema.go:56 +0x45
sync.(*WaitGroup).Wait(0xc0055fc148)
	sync/waitgroup.go:130 +0x65
github.com/ethereum/go-ethereum/p2p.(*Peer).run(0xc0055fc120, 0x1428e40, 0xc004a4bd80, 0x0)
	github.com/ethereum/go-ethereum/p2p/peer.go:291 +0x333
github.com/ethereum/go-ethereum/p2p.(*Server).runPeer(0xc000143b80, 0xc0055

This is due (I think) to the peer threads being stuck waiting for the res to return here:

goroutine 638 [chan receive, 29 minutes]:
github.com/ethereum/go-ethereum/eth/protocols/eth.(*Peer).dispatchResponse(0xc0050b1ba0, 0xc005874180, 0xc005b47700, 0x0, 0x0)
	github.com/ethereum/go-ethereum/eth/protocols/eth/dispatcher.go:174 +0x32c
github.com/ethereum/go-ethereum/eth/protocols/eth.handleBlockHeaders66(0x1969610, 0xc00134e5a0, 0x19560f8, 0xc005874120, 0xc0050b1ba0, 0xc06e2bdeb22d8111, 0x6d264dab5)
	github.com/ethereum/go-ethereum/eth/protocols/eth/handlers.go:367 +0x1d9
github.com/ethereum/go-ethereum/eth/protocols/eth.handleMessage(0x1969610, 0xc00134e5a0, 0xc0050b1ba0, 0x0, 0x0)
	github.com/ethereum/go-ethereum/eth/protocols/eth/handler.go:215 +0x46f
github.com/ethereum/go-ethereum/eth/protocols/eth.Handle(0x1969610, 0xc00134e5a0, 0xc0050b1ba0, 0xc002c1a600, 0xc0000c09a0)
	github.com/ethereum/go-ethereum/eth/protocols/eth/handler.go:154 +0x45
github.com/ethereum/go-ethereum/eth/protocols/eth.MakeProtocols.func1.1(0xc0050b1ba0, 0x17ce820, 0xc004657440)
	github.com/ethereum/go-ethereum/eth/protocols/eth/handler.go:111 +0x3d
github.com/ethereum/go-ethereum/eth.(*handler).runEthPeer(0xc00134e5a0, 0xc0050b1ba0, 0xc0055cf710, 0x0, 0x0)
	github.com/ethereum/go-ethereum/eth/handler.go:444 +0xc05
github.com/ethereum/go-ethereum/eth.(*ethHandler).RunPeer(0xc00134e5a0, 0xc0050b1ba0, 0xc0055cf710, 0xc0050dc6e0, 0x7f5481ee4d78)
	github.com/ethereum/go-ethereum/eth/handler_eth.go:41 +0x3f
github.com/ethereum/go-ethereum/eth/protocols/eth.MakeProtocols.func1(0xc0055fc120, 0x1954b40, 0xc0050dc6e0, 0x0, 0x0)

@karalabe
Copy link
Member

karalabe commented Jan 7, 2022

Good catch.

@holiman Are the hangs before or after this PR?

@holiman
Copy link
Contributor Author

holiman commented Jan 7, 2022

The hangs are without this PR (edited to clarify)

@karalabe karalabe added this to the 1.10.16 milestone Jan 7, 2022
Copy link
Member

@karalabe karalabe left a comment

LGTM

@karalabe karalabe merged commit adc0a6a into ethereum:master Jan 7, 2022
1 check failed
sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Jan 11, 2022
@mohamedmansour
Copy link

mohamedmansour commented Feb 16, 2022

For inclusivity should we rename it to allowlist?

@ryanschneider
Copy link
Contributor

ryanschneider commented Feb 16, 2022

For inclusivity should we rename it to allowlist?

I definitely agree a more inclusive (and descriptive!) name would be better, I'll start a PR that deprecates the current name and chooses a new one as soon as I can, will link it here when ready.

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.

None yet

4 participants