Skip to content

eth: continue after whitelist check#24210

Merged
karalabe merged 1 commit intoethereum:masterfrom
holiman:whitelist_investigate
Jan 7, 2022
Merged

eth: continue after whitelist check#24210
karalabe merged 1 commit intoethereum:masterfrom
holiman:whitelist_investigate

Conversation

@holiman
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

karalabe commented Jan 7, 2022

Good catch.

@holiman Are the hangs before or after this PR?

@holiman
Copy link
Copy Markdown
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
Copy Markdown
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 adc0a6a into ethereum:master Jan 7, 2022
sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Jan 11, 2022
@mohamedmansour
Copy link
Copy Markdown
Member

For inclusivity should we rename it to allowlist?

@ryanschneider
Copy link
Copy Markdown
Contributor

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.

4 participants