Skip to content

fix(functions): set nofile ulimit for Edge Runtime container#5152

Merged
avallete merged 4 commits intosupabase:developfrom
wucm667:fix/edge-runtime-nofile-ulimit
Apr 30, 2026
Merged

fix(functions): set nofile ulimit for Edge Runtime container#5152
avallete merged 4 commits intosupabase:developfrom
wucm667:fix/edge-runtime-nofile-ulimit

Conversation

@wucm667
Copy link
Copy Markdown
Contributor

@wucm667 wucm667 commented Apr 30, 2026

Fixes #5151

What type of PR is this?

  • bug

What this PR does / why it is needed:

The Edge Runtime container was started with Docker's default nofile ulimit (1024 soft limit). For projects with many Edge Functions (200+) and long-running local dev sessions, the per-isolate file descriptor usage accumulates until new isolates fail to boot with:

worker boot error: failed to bootstrap runtime: Reading /root/.cache/deno/npm/...: Too many open files (os error 24)

This PR sets the nofile ulimit to 65536 (both soft and hard) for the Edge Runtime container, allowing sufficient file descriptors for Deno isolates handling many concurrent functions.

Changes:

  • Add Resources.Ulimits to the container.HostConfig in ServeFunctions, setting nofile to 65536

Reproduction:

  1. Project with ~200 Edge Functions
  2. supabase start
  3. Let it run several hours; alphabetically late functions start returning HTTP 503 BOOT-FEHLER
  4. After this fix, the container starts with 65536 file descriptors, preventing the issue

The Edge Runtime container was started with Docker's default nofile
ulimit (1024 soft), causing "Too many open files" errors for projects
with 200+ Edge Functions running long dev sessions.

Set nofile ulimit to 65536 (soft and hard) to allow sufficient file
descriptors for Deno isolates handling many concurrent functions.

Fixes supabase#5151

Signed-off-by: wucm667 <stevenwucongmin@gmail.com>
@wucm667 wucm667 requested a review from a team as a code owner April 30, 2026 06:38
@avallete
Copy link
Copy Markdown
Member

Hey there !

Thank you for your contribution !

Comment thread internal/functions/serve/serve.go
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 30, 2026

Coverage Report for CI Build 25156940952

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.004%) to 63.757%

Details

  • Coverage increased (+0.004%) from the base build.
  • Patch coverage: 10 of 10 lines across 1 file are fully covered (100%).
  • 5 coverage regressions across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

5 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
internal/utils/git.go 5 57.14%

Coverage Stats

Coverage Status
Relevant Lines: 15628
Covered Lines: 9964
Line Coverage: 63.76%
Coverage Strength: 7.0 hits per line

💛 - Coveralls

@avallete avallete enabled auto-merge (squash) April 30, 2026 08:47
@avallete avallete merged commit a11f261 into supabase:develop Apr 30, 2026
10 checks passed
@wucm667 wucm667 deleted the fix/edge-runtime-nofile-ulimit branch April 30, 2026 09:30
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.

Edge Runtime container: nofile ulimit not configurable, leads to "Too many open files" after extended uptime

3 participants