a playground on an ephemeral port another process holds on loopback should not leave its clients hanging
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 30/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 领域
- database, networking
调研方向
Start with test-resolves-other-db in the multi-db test namespace (multi_db_test.clj, around line 22), where the pgjdbc connection is built, and with the Playground's connection builder, which turns a wildcard bind into localhost. Reproducing needs a macOS machine with another process holding the same port on loopback. Done means the test fails within a bounded timeout instead of hanging, and the bind behaviour for ephemeral ports is decided, since the issue lists several approaches without choosing one.
由索引模型根据 Issue 内容生成。
描述
A full ./gradlew test run on macOS hung for over an hour in xtdb.sql.multi-db-test/test-resolves-other-db. The test's pgjdbc connection to the playground connected, then waited forever for a reply that never came, because it had reached a different process.
Symptoms
- The suite's hang watchdog reported
no test activity for 257s (last event: started: test-resolves-other-db)and dumped threads, but the run then sat idle until killed. - The
Test workerthread was parked inorg.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(reading the server's first reply) underxtdb.api.DataSource$ConnectionBuilder.buildatmulti_db_test.clj:22. - On the server side both pgwire accept loops were parked in
accept, and no connection handler existed for that client.
Root cause
The playground had come up on 0.0.0.0:49152, the first ephemeral port, straight after the previous server took 65534 and 65535. netstat -Lan showed two listeners on that port:
0/0/50 *.49152 the playground (wildcard)
0/0/128 127.0.0.1.49152 another process, bound to loopback specifically
- The bind succeeds on macOS. Java's
ServerSocketsetsSO_REUSEADDR, and BSD lets a wildcard bind share a port with an existing address-specific one. - The client reaches the other process.
Playground's connection builder turns a wildcard bind intolocalhost, and the kernel routes127.0.0.1:49152to the more specific loopback binding. - Nothing times the client out. The test's connection sets no
socketTimeoutorloginTimeout, so pgjdbc waits forever for the other process to speak Postgres.
Assumptions
assumption:the other listener was Tailscale's system extension.lsofwithout root couldn't see its owner, but Tailscale held an established connection to127.0.0.1:49152at the same time.assumption:Linux refuses the wildcard bind while the specific one is listening, so this is macOS-only, and CI on Linux won't see it.assumption:a node bound with:port 0in any test has the same exposure; the playground just happened to land on the contested port.
Potential approaches
- The server could bind with
setReuseAddress falsewhen asked for an ephemeral port, so the kernel never hands out a port that is already held on a specific address. - Test connections could carry a
socketTimeout, so a wrong peer fails the test instead of hanging the suite. - The hang watchdog could fail the run once it has reported, rather than leaving it idle.
- 主要语言
- Clojure
- 星标
- 3.1k
- 派生
- 193
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 73
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
xtdb/xtdb 的其他 Issue
-
unshaved-yak
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
sql unshaved-yak
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
flaky
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
metrics
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
相似的 Issue
-
.Needs Triage .Team/UXWest Misc/Accessibility Priority:P3 Type:New Feature
难度 2/5 1-3 小时 新手友好度 78/100
metabase/metabase#88153 · 1 条评论 ·
维护者通常 1 天内回复
-
needs triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
editor-code-assistant/eca#717 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
nasa/Common-Metadata-Repository#2544 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100