Can not disconnect from a circuit-relay server node
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.6k
- Forks
- 546
- Avg merge
- 8h 18m
- Merged PRs (30d)
- 16
Description
- **Version**:
libp2p: 2.2.1
@libp2p/circuit-relay-v2: 3.1.0
- **Subsystem**:
circuit-relay-server
#### Severity:
Medium/low
#### Description:
I am doing some testing where I use `libp2p.hangUp(peerId)` and try to disconnect from a node that is also a circuit relay server. But it reconnects immediately
```
at DefaultConnectionManager.openConnection (file:///path-to-project/node_modules/libp2p/src/connection-manager/index.ts:484:10)
at pRetry.signal (file:///path-to-project/node_modules/libp2p/src/connection-manager/reconnect-queue.ts:83:40)
at RetryOperation._fn (file:///path-to-project/node_modules/p-retry/index.js:57:26)
at RetryOperation.attempt (/path-to-project/node_modules/p-retry/node_modules/retry/lib/retry_operation.js:116:8)
at file:///path-to-project/node_modules/p-retry/index.js:55:13
at new Promise ()
at pRetry (file:///path-to-project/node_modules/p-retry/index.js:31:9)
at Job.queue.add.peerId.peerId [as fn] (file:///path-to-project/node_modules/libp2p/src/connection-manager/reconnect-queue.ts:77:13)
at Job.run (file:///path-to-project/node_modules/@libp2p/utils/src/queue/job.ts:77:44)
at PeerQueue.tryToStartAnother (file:///path-to-project/node_modules/@libp2p/utils/src/queue/index.ts:191:16)
at PeerQueue.add (file:///path-to-project/node_modules/@libp2p/utils/src/queue/index.ts:233:10)
at ReconnectQueue.maybeReconnect (file:///path-to-project/node_modules/libp2p/src/connection-manager/reconnect-queue.ts:76:16)
```
My question/concern is that there is no easy way to hangUp it seems in this case, unless if I perhaps also modify the peerStore to remove the KEEP_ALIVE tag (seems not to be enough from testing)
I wonder if it would make sense to have a way to call `hangUp` that circumvent all possible reconnection logic
#### Steps to reproduce the error:
Create an env with two nodes, perhaps both are also circuit relay servers. Try to handUp on the other node
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reconnect path in src/connection-manager/index.ts and src/connection-manager/reconnect-queue.ts, then reproduce the issue using two circuit-relay server nodes and libp2p.hangUp(peerId). Review how KEEP_ALIVE tags and reconnection are involved; done should be defined as a hangUp that does not immediately reconnect when the caller requests disconnection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100