Skip to content

fix: add maxTotalSockets to prevent socket exhaustion across IPv4/IPv6 - #156

Merged
AbirAbbas merged 1 commit into
mainfrom
fix/max-total-sockets
Jan 21, 2026
Merged

fix: add maxTotalSockets to prevent socket exhaustion across IPv4/IPv6#156
AbirAbbas merged 1 commit into
mainfrom
fix/max-total-sockets

Conversation

@AbirAbbas

Copy link
Copy Markdown
Contributor

Summary

  • Fix socket exhaustion in dual-stack (IPv4 + IPv6) environments
  • Add maxTotalSockets: 50 to limit total connections across ALL hosts
  • Railway DNS returns both IPv4 and IPv6 which were treated as separate hosts

Root Cause

maxSockets: 10 only limits connections per-host, but IPv4 and IPv6 addresses are treated as different hosts by Node.js http.Agent. This caused unbounded connection growth (28k+ connections in 10 minutes).

Changes

  • Add maxTotalSockets: 50 to all http.Agent instances
  • Remove deprecated timeout option from http.Agent
  • Bump SDK version to 0.1.35
  • Update init-example to use 0.1.35

Test plan

  • Merge and publish SDK 0.1.35
  • Redeploy Railway agent
  • Verify connections stay bounded with cat /proc/net/sockstat

🤖 Generated with Claude Code

The previous fix with maxSockets only limited connections per-host, but
Railway's internal DNS returns both IPv4 and IPv6 addresses which are
treated as separate hosts. This caused connections to grow unbounded.

Adding maxTotalSockets: 50 limits total connections across ALL hosts,
properly preventing socket exhaustion in dual-stack environments.

Changes:
- Add maxTotalSockets: 50 to all http.Agent instances
- Remove deprecated timeout option from http.Agent
- Bump SDK version to 0.1.35
- Update init-example to use 0.1.35

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Performance

SDK Memory Δ Latency Δ Tests Status
TS 336 B -4% 1.55 µs -22%

✓ No regressions detected

@AbirAbbas
AbirAbbas merged commit d1f4175 into main Jan 21, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant