stack: gateway still opens a new upstream connection per request on 2.119.0 (exhausts ephemeral ports on macOS)
维护者通常 1 天内回复
@rbSparky 已经在做这个了。
开始于 2026年10月7日。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- postgresql, typescript
调研方向
Start by locating the native-runtime HTTP gateway's upstream request handling and tracing how it connects to PostgREST and Auth. Reproduce the reported Playwright contract-suite load against one local stack and inspect connection reuse and TIME_WAIT counts. Done means proxied requests reuse upstream connections and the run no longer exhausts ephemeral ports or produces the reported transient failures.
由索引模型根据 Issue 内容生成。
描述
Summary
On CLI 2.119.0 (which contains #6925, the fix for #6922), the native-runtime HTTP gateway still opens a new upstream TCP connection per proxied request to PostgREST and Auth. Under a test suite's load this exhausts macOS's ephemeral port range within a single run. Requests then fail with Bad Gateway, fetch failed, and Auth's failed to connect … connect: can't assign requested address.
Environment
- Supabase CLI 2.119.0 (Homebrew),
[experimental] stack = true, native runtime - macOS 26.6.2, Apple silicon. Ephemeral range 49152–65535,
net.inet.tcp.msl=15000. - Slim services from the stack cache: PostgREST
v16.4-r0, Authv2.197.0-r0(darwin-arm64)
Reproduction
A Playwright contract suite of about 1,160 tests (2 workers, supabase-js clients, mostly RPC calls and auth.admin.createUser) run against one local stack. It takes about 40s.
Evidence
TIME_WAIT sockets, sampled every 2s through a single run that started from a drained machine (6 sockets): peak 16,309, effectively the entire ephemeral range.
Grouped by destination port, about 25s into a run:
| Destination | Listener | TIME_WAIT |
|---|---|---|
| 64008 | postgrest/v16.4-r0/.../.postgrest-wrapped |
8,547 |
| 24782 | stack Postgres (database.sql) |
4,180 |
| 63992 | auth/v2.197.0-r0/.../.auth-wrapped |
693 |
| 23647 | the public gateway (client side) | 433 |
So the client-to-gateway hop reuses connections (433), while the gateway-to-PostgREST and gateway-to-Auth hops do not. The Postgres churn looks like #6981 (Auth keeps no idle connections).
Auth's log at the failure:
"error":"Unhandled server error: couldn't start a new transaction: could not create new transaction:
failed to connect to `host=127.0.0.1 user=supabase_auth_admin database=postgres`:
dial error (dial tcp 127.0.0.1:24782: connect: can't assign requested address)"
Test-visible errors: Bad Gateway on REST and Storage, fetch failed, Database error querying schema / Database error checking email from Auth. All are transient and clear once TIME_WAIT drains.
Workaround
sudo sysctl -w net.inet.tcp.msl=1000 (frees a closed port in 2s instead of 30s).
Related
#6922 (closed by #6925), #6975, #6981
- 主要语言
- TypeScript
- 星标
- 2.4k
- 派生
- 531
- 平均合并
- 1 天 4 小时
- 30 天内合并 PR
- 346
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
supabase/cli 的其他 Issue
-
db schema declarative sync: no way to fail (non-zero exit) when the generated migration is destructive可能重新可做 关联的 PR 已关闭且未合并。 未关闭✨ Feature supabase/cli
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
stack: the HTTP gateway closes idle keep-alive connections after 5 s, so a client whose event loop is blocked gets ECONNRESET (`fetch failed`) on its next request可能已有人在做 @7ttp 于 5 天前认领。 未关闭🐛 Bug supabase/cli
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
📘 Docs supabase/cli
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
🐛 Bug supabase/cli
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
config push sends [auth.sms] enable_confirmations un-negated as sms_autoconfirm, so hosted projects get the opposite of local可能已有人在做 @7ttp 于 3 天前认领。 未关闭🐛 Bug supabase/cli
维护者通常 1 天内回复
相似的 Issue
-
Flaky: mongodb-memory-server 'Port already in use' when another process starts a mongod concurrently未关闭area:testing bug effort:S priority:P2
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
lens:agent lens:process process
难度 2/5 1-3 小时 新手友好度 82/100
thebristolsound/birdbrain#1772 ·
维护者通常 1 天内回复
-
bug priority:low ready-for-dev
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
Automattic/data-liberation-agent#685 ·
维护者通常 1 天内回复
-
Business
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复