ChainSafe / ChainSafe/lodestar

Peer disconnected during identify protocol

Open
#8,300 1 comment 0 reactions 0 assignees View on GitHub
meta-bug
Dominant language
TypeScript
Stars
1.4k
Forks
483
Avg merge
1d 16h
Merged PRs (30d)
150

Description

### Describe the bug

after #8188 I found too many "Peer disconnected during identify protocol" and it only happens on some specific peers

on one of `fusaka-devnet-3` nodes:

```
grep -e "Peer disconnected during identify protocol" -rn beacon-2025-08-31.log | wc -l
146806
```

we need to review if calling `libp2p.identify` is suitable inside `onLibp2pPeerConnect` given this documentation from this method

```
export interface Identify {
/**
* Please use with caution.
*
* Due to the default limits on inbound/outbound streams for this protocol,
* invoking this method when runOnConnectionOpen is true can lead to
* unpredictable results as streams may be closed by the local or the remote
* node.
*
* If you find yourself needing to call this method to discover other peers
* that support your protocol, you may be better off configuring a topology to
* be notified instead.
*
* Alternatively the libp2p node itself will emit `peer:identify` events after
* identify has taken place which can be used to passively detect new peers.
*/
identify(connection: Connection, options?: AbortOptions): Promise
}
```

### Expected behavior

- no error, or comes up with reason
- should we handle `peer:identify` instead? cc @wemeetagain

### Steps to reproduce

_No response_

### Additional context

_No response_

### Operating system

Linux

### Lodestar version or commit hash

unstable

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.