koinos / koinos-p2p

The p2p microservice orchestrates the distribution of blocks and transactions between peers.
MIT License
6 stars 4 forks source link

[BUG]: Incorrect seed causes panic #280

Open mvandeberg opened 1 year ago

mvandeberg commented 1 year ago

Is there an existing issue for this?

Current behavior

When a seed peer address is malformed, instead of logging to error and continuing or exiting, p2p currently panics.

koinos-p2p-1  | 2023-02-10 18:28:24.927421 (p2p.Koinos) [p2p/connection_manager.go:109] <warn>: Error parsing peer address: failed to parse multiaddr "/dns4/seed-west.burnkoin.com/tcp/8888/p2p/QmcwsnczsFRxgkyYtTWK4dq6tbE5tpE48jtHp7nKAvy22V\\": invalid value "QmcwsnczsFRxgkyYtTWK4dq6tbE5tpE48jtHp7nKAvy22V\\" for protocol p2p: failed to parse p2p addr: QmcwsnczsFRxgkyYtTWK4dq6tbE5tpE48jtHp7nKAvy22V\ input isn't valid multihash
koinos-p2p-1  | 2023-02-10 18:28:24.927453 (p2p.Koinos) [p2p/connection_manager.go:114] <warn>: Error parsing peer address: invalid p2p multiaddr
koinos-p2p-1  | panic: runtime error: invalid memory address or nil pointer dereference
koinos-p2p-1  | [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa9e72a]
koinos-p2p-1  | 
koinos-p2p-1  | goroutine 1 [running]:
koinos-p2p-1  | github.com/koinos/koinos-p2p/internal/p2p.NewConnectionManager({0x15572e0?, 0xc000305cc8}, {0x1555520, 0xc0000103f0}, 0xc0001e81b8, {0x1541f60, 0xc00029fce0}, {0xc000a9e100, 0x4, 0x4}, ...)
koinos-p2p-1  |         /koinos-p2p/internal/p2p/connection_manager.go:117 +0x4aa
koinos-p2p-1  | github.com/koinos/koinos-p2p/internal/node.NewKoinosP2PNode({0x154d070?, 0xc00017c140}, {0xc000a90030, 0x15}, {0x1555520?, 0xc0000103f0}, 0xc00013c0a0, {0x0, 0x0}, 0xc0001e8180)
koinos-p2p-1  |         /koinos-p2p/internal/node/node.go:186 +0xf4a
koinos-p2p-1  | main.main()
koinos-p2p-1  |         /koinos-p2p/cmd/koinos-p2p/main.go:201 +0x1c2d

Expected behavior

The microservice should log the error and continue, if possible.

Steps to reproduce

Environment

- OS: Ubuntu 22.04 Docker

Anything else?

No response

koinos-ci commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.