Skip to content

feat:add limit for a maximum incoming connections#1899

Merged
jakubno merged 15 commits intomainfrom
feat/limit-number-of-incoming-requests-to-the-sandbox-eng-3488
Feb 17, 2026
Merged

feat:add limit for a maximum incoming connections#1899
jakubno merged 15 commits intomainfrom
feat/limit-number-of-incoming-requests-to-the-sandbox-eng-3488

Conversation

@jakubno
Copy link
Member

@jakubno jakubno commented Feb 12, 2026

image

Note

Medium Risk
Touches core request routing in the shared proxy and introduces request blocking behavior (429) based on runtime feature flags, so misconfiguration or limiter bugs could cause unexpected traffic drops.

Overview
Adds a feature-flag-controlled per-sandbox cap on concurrent incoming HTTP proxy requests; when the limit is exceeded, the proxy returns a dedicated 429 Too Many Requests templated error response.

This wires a shared connlimit.ConnectionLimiter into the shared reverse proxy handler (with acquire/release timing and blocked counters), adds new ingress-proxy telemetry histograms/counters, updates orchestrator startup/tests to pass feature flags and clean up limiter state on sandbox removal, and refactors TCP firewall to reuse the shared limiter implementation.

Written by Cursor Bugbot for commit bee88b7. This will update automatically on new commits. Configure here.

@linear
Copy link

linear bot commented Feb 12, 2026

@jakubno jakubno force-pushed the feat/limit-number-of-incoming-requests-to-the-sandbox-eng-3488 branch from 5749c2d to 7a57775 Compare February 12, 2026 22:53
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@jakubno jakubno marked this pull request as ready for review February 13, 2026 02:15
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14a37c8b3e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dobrac
Copy link
Contributor

dobrac commented Feb 13, 2026

add please also a histogram metric (same as egress firewall connections per sandbox) + the duration

@ValentaTomas
Copy link
Member

Can this limiting be implemented by using the MaxConnsPerHost on the http.Transport in the https://github.com/e2b-dev/infra/blob/feat/limit-number-of-incoming-requests-to-the-sandbox-eng-3488/packages/shared/pkg/proxy/pool/client.go?

The only disadvantage I see is that this way of limitation would block when we reach the limit, which means that we would still keep the connection around on the client proxy and we won't be able to quickly return appropriate error.

@ValentaTomas
Copy link
Member

Also, for clarity, thinking about actually returning https://http.dev/509

@jakubno jakubno requested a review from dobrac February 16, 2026 23:38
@jakubno jakubno force-pushed the feat/limit-number-of-incoming-requests-to-the-sandbox-eng-3488 branch from 8239c48 to d660378 Compare February 17, 2026 02:31
@jakubno jakubno merged commit 68b7657 into main Feb 17, 2026
34 checks passed
@jakubno jakubno deleted the feat/limit-number-of-incoming-requests-to-the-sandbox-eng-3488 branch February 17, 2026 03:23
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.

3 participants