Skip to content

fix(featureflags): default per-sandbox connection limits to a finite cap - #3813

Open
AdaAibaby wants to merge 1 commit into
e2b-dev:mainfrom
AdaAibaby:c1-conn-limit-defaults
Open

AdaAibaby wants to merge 1 commit into
e2b-dev:mainfrom
AdaAibaby:c1-conn-limit-defaults

Conversation

@AdaAibaby

Copy link
Copy Markdown
Contributor

fix(featureflags): default per-sandbox connection limits to a finite cap

Re: #3681. TCPFirewallMaxConnectionsPerSandbox (egress TCP firewall) and
SandboxMaxIncomingConnections (ingress HTTP proxy) both defaulted to -1
(unlimited). connlimit.TryAcquire treats maxLimit < 0 as always-admit, so the
per-sandbox connection limiters that already exist in the orchestrator are
INERT in any deployment that does not set these flags — including, by default,
a self-hosted / OSS deployment with no LaunchDarkly override. That is exactly
the unbounded shared-host-resource boundary #3681 asks about: a sandbox can hold
unlimited host connections/goroutines/fds with no per-sandbox accounting.

Default both to a generous finite cap (1024) so the limiters are active out of
the box. The limiters, metrics, and refusal paths already exist; this only flips
the default so they engage.

Blast radius: e2b's own deployments set these via LaunchDarkly, which overrides
the code default, so prod behavior is unchanged except where LD returns null.
Deployments with no override go from unbounded to a 1024 ceiling — strictly
safer. Operators raise or disable (-1) per team via the flag.

Note on the value: 1024 is a conservative starting point, well above any normal
per-sandbox connection count (the #3681 PoC used 32) and in line with existing
finite caps in this file (MaxSandboxesPerNode=200, RemoteClusterInstancesPerConnection=64,
freeze-guest-hierarchy-max-cgroups=512). The exact number is a deployment policy
call — happy to adjust to whatever the maintainers prefer; the flag makes it a
one-line change and a runtime override.

Re: e2b-dev#3681. TCPFirewallMaxConnectionsPerSandbox (egress TCP firewall) and
SandboxMaxIncomingConnections (ingress HTTP proxy) both defaulted to -1
(unlimited). connlimit.TryAcquire treats maxLimit < 0 as always-admit, so the
per-sandbox connection limiters that already exist in the orchestrator are
INERT in any deployment that does not set these flags — including, by default,
a self-hosted / OSS deployment with no LaunchDarkly override. That is exactly
the unbounded shared-host-resource boundary e2b-dev#3681 asks about: a sandbox can hold
unlimited host connections/goroutines/fds with no per-sandbox accounting.

Default both to a generous finite cap (1024) so the limiters are active out of
the box. The limiters, metrics, and refusal paths already exist; this only flips
the default so they engage.

Blast radius: e2b's own deployments set these via LaunchDarkly, which overrides
the code default, so prod behavior is unchanged except where LD returns null.
Deployments with no override go from unbounded to a 1024 ceiling — strictly
safer. Operators raise or disable (-1) per team via the flag.

Note on the value: 1024 is a conservative starting point, well above any normal
per-sandbox connection count (the e2b-dev#3681 PoC used 32) and in line with existing
finite caps in this file (MaxSandboxesPerNode=200, RemoteClusterInstancesPerConnection=64,
freeze-guest-hierarchy-max-cgroups=512). The exact number is a deployment policy
call — happy to adjust to whatever the maintainers prefer; the flag makes it a
one-line change and a runtime override.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants