[Medium] Connection Pool Exhaustion Under High Peer Load #23

Open
opened 2026-02-11 19:31:46 +00:00 by thabeta · 0 comments
Owner

Issue

The mycelium network node lacks a backpressure or rate-limiting mechanism for the peer connection pool, leading to resource exhaustion under high load.

Location

mycelium/src/connection/

Problem Description

When many peers attempt to connect or re-connect simultaneously, the node will spawn tasks or allocate buffers for each connection without a global cap. This can exhaust:

  • File descriptors
  • Memory (buffers + task stack)
  • CPU cycles for handshakes

Impact

  • Severity: MEDIUM (Reliability)
  • Frequency: High during network restarts or mass peer migration
  • User Impact: Local node crashes or becomes unresponsive to known peers

Remediation

  1. Define a global maximum for active peer connections
  2. Implement an exponential backoff for re-connection attempts
  3. Use a semaphore or token bucket to limit concurrent handshakes
  4. Gracefully drop connections from unknown peers when resources are low

Testing

  • Launch 500+ spoofed connection requests at a single node
  • Monitor memory and FD usage
  • Verify the node remains responsive to existing routes
## Issue The mycelium network node lacks a backpressure or rate-limiting mechanism for the peer connection pool, leading to resource exhaustion under high load. ## Location `mycelium/src/connection/` ## Problem Description When many peers attempt to connect or re-connect simultaneously, the node will spawn tasks or allocate buffers for each connection without a global cap. This can exhaust: - File descriptors - Memory (buffers + task stack) - CPU cycles for handshakes ## Impact - **Severity**: MEDIUM (Reliability) - **Frequency**: High during network restarts or mass peer migration - **User Impact**: Local node crashes or becomes unresponsive to known peers ## Remediation 1. Define a global maximum for active peer connections 2. Implement an exponential backoff for re-connection attempts 3. Use a semaphore or token bucket to limit concurrent handshakes 4. Gracefully drop connections from unknown peers when resources are low ## Testing - Launch 500+ spoofed connection requests at a single node - Monitor memory and FD usage - Verify the node remains responsive to existing routes
Sign in to join this conversation.
No labels
Urgent
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
geomind_code/mycelium_network#23
No description provided.