Skip to content

fix(proxy): configure proxy agent connection limits and IPv4 support#2303

Merged
fallenbagel merged 3 commits intodevelopfrom
fallenbagel/fix/proxy-agent-connection-timeout
Jan 20, 2026
Merged

fix(proxy): configure proxy agent connection limits and IPv4 support#2303
fallenbagel merged 3 commits intodevelopfrom
fallenbagel/fix/proxy-agent-connection-timeout

Conversation

@fallenbagel
Copy link
Collaborator

@fallenbagel fallenbagel commented Jan 16, 2026

Description

Configures axios and undici proxy agents with connection pool limits and idle timeouts to prevent connection accumulation. The undici agents already had keepAliveTimeout: 5000 configured, but we're missing connection limits and axios was using Node's default agent with unlimited sockets and no idle timeout. This caused connections to accumulate over time.

This PR adds maxSockets and maxFreeSockets to bound the connection pool, a matching 5 second idle timeout, and LIFO scheduling to naturally cycle out older connections. connections limit of 50 were also added to undici agents (defaultAgent and ProxyAgent). In addition, it also passes the forceIpv4First setting to the proxy agent which previously overwrote that option, breaking the IPV4-first resolution when both proxy and `forceIpv4First were enabled.

How Has This Been Tested?

(no need tbh).

Screenshots / Logs (if applicable)

Checklist:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required)

@fallenbagel fallenbagel requested a review from Copilot January 16, 2026 01:13
@fallenbagel fallenbagel added the bug Something isn't working label Jan 16, 2026
@fallenbagel fallenbagel requested a review from a team as a code owner January 16, 2026 01:13

This comment was marked as outdated.

…leaks

Add socket pool configuration to HttpProxyAgent and HttpsProxyAgent to
prevent connection leaks.

fix #2297
@fallenbagel fallenbagel force-pushed the fallenbagel/fix/proxy-agent-connection-timeout branch from 39cb412 to f46773e Compare January 16, 2026 01:26
@seerr-team seerr-team deleted a comment from Copilot AI Jan 16, 2026
@seerr-team seerr-team deleted a comment from Copilot AI Jan 16, 2026
@fallenbagel fallenbagel requested a review from Copilot January 16, 2026 01:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fallenbagel fallenbagel changed the title fix: add timeout to axios proxy agents to prevent connection leaks fix(proxy): configure axios proxy agents with connection limits and preserve IPv4 setting Jan 16, 2026
@fallenbagel fallenbagel requested a review from Copilot January 16, 2026 01:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fallenbagel fallenbagel requested review from a team and gauthier-th January 17, 2026 02:10
@fallenbagel fallenbagel changed the title fix(proxy): configure axios proxy agents with connection limits and preserve IPv4 setting fix(proxy): configure proxy agent connection limits and IPv4 support Jan 17, 2026
Copy link
Member

@gauthier-th gauthier-th left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. We should probably create a preview tag to test this before merging?

@fallenbagel fallenbagel added the preview PRs deployed for testing with tag `:preview-prxx` label Jan 17, 2026
@fallenbagel
Copy link
Collaborator Author

LGTM. We should probably create a preview tag to test this before merging?

Preview deployed

@fallenbagel fallenbagel enabled auto-merge (squash) January 20, 2026 08:12
@gauthier-th
Copy link
Member

Fix confirmed working.

@fallenbagel fallenbagel merged commit dbd5935 into develop Jan 20, 2026
13 checks passed
@fallenbagel fallenbagel deleted the fallenbagel/fix/proxy-agent-connection-timeout branch January 20, 2026 11:37
0xSysR3ll pushed a commit to 0xSysR3ll/jellyseerr that referenced this pull request Jan 20, 2026
…eerr-team#2303)

* fix: configure axios proxy agent socket limits to prevent connection leaks

Add socket pool configuration to HttpProxyAgent and HttpsProxyAgent to
prevent connection leaks.

fix seerr-team#2297

* fix(proxy): pass forceIpv4First option to custom proxy agent

* fix(proxy): add connection limits and IPv4 support to undici agents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working preview PRs deployed for testing with tag `:preview-prxx`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP connection leak to Sonarr/Radarr causes downstream service deadlock

3 participants