ChainSafe / lodestar

🌟 TypeScript Implementation of Ethereum Consensus
https://lodestar.chainsafe.io
Apache License 2.0
1.19k stars 290 forks source link

Uncaught exception: Cannot read properties of undefined (reading '0') #5733

Closed nflaig closed 1 year ago

nflaig commented 1 year ago

Describe the bug

After upgrade to libp2p 0.45.9, there are frequent uncaught exceptions

Jul-05 13:35:02.052[]                error: uncaughtException: Cannot read properties of undefined (reading '0')
TypeError: Cannot read properties of undefined (reading '0')
    at Libp2pNode.PeerDiscovery.onDiscoveredPeer (file:///home/devops/goerli/lodestar/packages/beacon-node/src/network/peers/discover.ts:276:60)
    at Libp2pNode.[nodejs.internal.kHybridDispatch] (node:internal/event_target:762:20)
    at Libp2pNode.dispatchEvent (node:internal/event_target:704:26)
    at Libp2pNode.dispatchEvent (file:///home/devops/goerli/lodestar/node_modules/@libp2p/interfaces/src/events.ts:64:26)
    at Libp2pNode.safeDispatchEvent (file:///home/devops/goerli/lodestar/node_modules/@libp2p/interfaces/src/events.ts:79:17)
    at EventEmitter.<anonymous> (file:///home/devops/goerli/lodestar/node_modules/libp2p/src/libp2p.ts:102:14)
    at EventEmitter.[nodejs.internal.kHybridDispatch] (node:internal/event_target:762:20)
    at EventEmitter.dispatchEvent (node:internal/event_target:704:26)
    at EventEmitter.dispatchEvent (file:///home/devops/goerli/lodestar/node_modules/@libp2p/interfaces/src/events.ts:64:26)
    at EventEmitter.Libp2pNode.events.dispatchEvent (file:///home/devops/goerli/lodestar/node_modules/libp2p/src/libp2p.ts:65:30) Cannot read properties of undefined (reading '0'

Expected behavior

No uncaught exception

Steps to reproduce

No response

Additional context

No response

Operating system

Linux

Lodestar version or commit hash

7280234bea66b49da3900b916a1b54c4666e4173

dapplion commented 1 year ago

CC @wemeetagain

wemeetagain commented 1 year ago

onDiscoveredPeer is called when a libp2p emits a newly discovered peer via a configured peer discovery module.

I believe the only peer discovery module (controlled by libp2p) that we may enable is mdns. Do you have mdns enabled?

nflaig commented 1 year ago

Do you have mdns enabled?

No, I am using default network options