flashbots / flashbots/mempool-dumpster

Chainbound channel leak

Open
#50 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
259
Forks
42
PR merge metrics
No merged PRs in 30d

Description

Starting a Chainbound connection
1. Creates a channel A to receive transactions
2. Spawns a goroutine to connect to Fiber
3. Blocks reading from channel A

https://github.com/flashbots/mempool-dumpster/blob/84c076852252151ff6aef0174a94a778464af6b2/collector/node_conn_chainbound.go#L55-L69

If an error occurs either when first connecting to Fiber or from an error receiving a new tx a reconnect is triggered

https://github.com/flashbots/mempool-dumpster/blob/84c076852252151ff6aef0174a94a778464af6b2/collector/node_conn_chainbound.go#L95-L99

or

https://github.com/flashbots/mempool-dumpster/blob/84c076852252151ff6aef0174a94a778464af6b2/collector/node_conn_chainbound.go#L109-L114

The reconnect will call start and a new channel B will be created. Channel A will not be closed and leak.
https://github.com/flashbots/mempool-dumpster/blob/84c076852252151ff6aef0174a94a778464af6b2/collector/node_conn_chainbound.go#L82

I'm not sure how much of a problem the leak is, but a more robust way to handle the connection lifecycle would be to create a centralized loop.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.