iotexproject / iotex-core

Official implementation of IoTeX blockchain protocol in Go. An ultra-efficient EVM blockchain offering 1000 TPS with instant 1-block finality. Perfect for DeFi, DePIN tokenomics, Identities, and any trusted logic requiring Web3 composability
https://iotex.io
Apache License 2.0
1.55k stars 324 forks source link

p2p peer QoS #2619

Open dustinxie opened 3 years ago

dustinxie commented 3 years ago

What would you like to be added: when unicast failed, add peer to blocklist for like 10 minutes, when same peer failed for 3 times, remove from peer list

Why is this needed: still seeing p2p send errors like this:

{"level":"error","ts":1619546190.2414005,"caller":"blocksync/worker.go:117","msg":"failed to sync block.","ioAddr":"io1nuydnt26f8prqrdx873vnmvqzarkf0sgyz5qxv","peer":"{12D3KooWPfQDF8ASjd4r7jS9e7F1wn6zod7Mf4ERr8etoY6ctQp5: [/ip4/127.0.0.1/tcp/4689 /ip4/10.20.13.33/tcp/4689 /ip4/35.231.168.52/tcp/1974 /ip4/35.237.67.212/tcp/4689 /ip4/35.237.67.212/tcp/4689/p2p/12D3KooWPfQDF8ASjd4r7jS9e7F1wn6zod7Mf4ERr8etoY6ctQp5 /ip4/10.20.4.15/tcp/4689 /dns4/bootnode-0.mainnet.iotex.one/tcp/4689/p2p/12D3KooWPfQDF8ASjd4r7jS9e7F1wn6zod7Mf4ERr8etoY6ctQp5 /dns4/bootnode-0.mainnet.iotex.one/tcp/4689 /ip4/10.20.34.78/tcp/4689 /ip4/35.231.168.52/tcp/8477 /ip4/35.231.168.52/tcp/63021 /ip4/35.231.168.52/tcp/41394 /ip4/35.237.209.227/tcp/4689 /ip4/35.185.100.25/tcp/1046 /ip4/10.20.26.23/tcp/4689 /ip4/10.20.34.148/tcp/4689 /ip4/10.8.2.19/tcp/4689 /ip4/10.20.34.97/tcp/4689 /ip4/35.231.168.52/tcp/63022]}","error":"error when sending unicast message: protocol not supported","errorVerbose":"protocol not supported\nerror when sending unicast message\ngithub.com/iotexproject/iotex-core/p2p.(*Agent).UnicastOutbound\n\t/go/apps/iotex-core/p2p/agent.go:351\ngithub.com/iotexproject/iotex-core/chainservice.New.func5\n\t/go/apps/iotex-core/chainservice/chainservice.go:344\ngithub.com/iotexproject/iotex-core/blocksync.(*syncWorker).Sync\n\t/go/apps/iotex-core/blocksync/worker.go:114\ngithub.com/iotexproject/iotex-core/pkg/routine.(*RecurringTask).Start.func1\n\t/go/apps/iotex-core/pkg/routine/recurringtask.go:48\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1373"}
CoderZhi commented 3 years ago

https://github.com/iotexproject/iotex-core/pull/2648