Exec wait never settles when the Docker stream closes without ending, and Node exits 0
維護者通常 4 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 72/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- docker, node.js, typescript
研究方向
找出 DockerContainerClient.waitForExecStreamToEnd;issue指出它只等待串流的end或error事件。先追蹤呼叫它的監聽連接埠檢查,並了解exec.inspect()如何處理結束代碼。當串流關閉時等待會結束,且未完成的檢查會持續重試直到啟動逾時,即為完成。
由索引模型根據 Issue 內容生成。
描述
Expected Behaviour
PostgreSqlContainer.start() resolves, or rejects with an error, when the listening-port check's docker exec stream closes.
Actual Behaviour
Sometimes the internal port check never finishes. DockerContainerClient.waitForExecStreamToEnd waits for the exec stream's end or error event only. When the stream emits close without end, that promise never settles. With nothing else keeping the event loop alive, Node exits with code 0, so a Vitest global setup that starts the container ends the whole run with code 0 before any test runs.
It happened in 3 of 12 CI jobs on one runner provider and none on another. Listening for close too (stream.on("close", res)) fixed it in 12 of 12 jobs. exec.inspect() then reports the exit code, and an unfinished check is retried until the startup timeout.
Testcontainers Logs
The last lines for the Postgres container in a failing job. Nothing follows Health check wait strategy complete, and Internal port 5432/tcp ready is never logged:
testcontainers [DEBUG] [d9f4513e9ba1] Waiting for container to be ready...
testcontainers [DEBUG] [d9f4513e9ba1] Waiting for host port 32772...
testcontainers [DEBUG] [d9f4513e9ba1] Waiting for internal port 5432/tcp...
testcontainers [DEBUG] [d9f4513e9ba1] Host port 32772 ready
testcontainers [DEBUG] [d9f4513e9ba1] Host port wait strategy complete
testcontainers [DEBUG] [d9f4513e9ba1] Health check wait strategy complete
A beforeExit listener showed the event loop draining with only stdio pipes left: beforeExit code=0 active=["PipeWrap","PipeWrap","PipeWrap"]. Nothing called process.exit.
Steps to Reproduce
- Start a
PostgreSqlContainerwith the default wait strategy (health check plus listening ports) in a VitestglobalSetup. - Run it repeatedly on a CI runner whose Docker daemon sometimes closes exec streams without ending them. We saw it on Docker Engine 29.7.2 (API 1.55).
- Some runs exit 0 right after
Health check wait strategy complete, without running any tests.
Environment Information
- Operating System: Ubuntu 24.04 (CI runner VM)
- Container runtime and version: Docker Engine 29.7.2, API 1.55
- Node version: 26.14.0
- Test runner and version: Vitest 5.1.2, ESM
- Testcontainers version: 12.2.2,
@testcontainers/postgresql12.2.2, imageghcr.io/baosystems/postgis:18-3.6 - Last Testcontainers version where this worked, if any: unknown
- 主要語言
- TypeScript
- 星號
- 2.7k
- 分支
- 290
- 平均合併
- 4 天 1 小時
- 30 天內合併 PR
- 22
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 提供 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
testcontainers/testcontainers-node 的其他 Issue
-
enhancement minor
難度 2/5 1-3 小時 新手友好度 74/100
testcontainers/testcontainers-node#1539 ·
維護者通常 4 天內回覆
-
Let `Wait.forListeningPorts()` wait on specific ports可能已有人在做 @artbom 於 29 天前認領。 未關閉enhancement minor
難度 2/5 1-3 小時 新手友好度 82/100
testcontainers/testcontainers-node#1533 ·
維護者通常 4 天內回覆
-
enhancement minor
難度 2/5 1-3 小時 新手友好度 77/100
testcontainers/testcontainers-node#1531 ·
維護者通常 4 天內回覆
-
Export the types used in public method signatures可能已有人在做 @artbom 於 29 天前認領。 未關閉enhancement minor
難度 2/5 1-3 小時 新手友好度 78/100
testcontainers/testcontainers-node#1528 ·
維護者通常 4 天內回覆
-
A consumer passed to withLogConsumer receives no logs after restart()可能已有人在做 @yabdelhamed 於 11 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 65/100
testcontainers/testcontainers-node#1663 ·
維護者通常 4 天內回覆
查看 testcontainers/testcontainers-node 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 67/100
makecindy/cindy#15342 · 1 則留言 ·
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 74/100
kwitsch/claude-code-plugin-tooling#219 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆
-
no-repo-link tool-submission
難度 1/5 1 小時以內 新手友好度 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
難度 2/5 1-3 小時 新手友好度 85/100