Make container reuse safe across processes
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- docker, node.js, typescript
Hướng nghiên cứu
Read reuseOrStartContainer in packages/testcontainers/src/generic-container/generic-container.ts and the existing withFileLock implementation in packages/testcontainers/src/common/file-lock.ts. Check the tests for reusable container startup and run the relevant test suite with multiple processes to reproduce the race. Done means concurrent callers on the same host share one container; the issue notes that #1522 and #1552 also change this function, so coordinate around that overlap.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
withReuse() looks for an existing container and creates one if there is none. That lookup-then-create is guarded by an in-process lock (AsyncLock), so two processes can both find nothing and both create a container.
Test runners commonly run test files in separate processes or workers. Starting the same reusable configuration from three processes at once created two containers. The extra one is never cleaned up, because reusable containers carry no session label.
Expected
Lookup-or-create is atomic across processes on the same host, so concurrent callers end up sharing one container.
Where
reuseOrStartContainer in packages/testcontainers/src/generic-container/generic-container.ts.
Notes
withFileLockinpackages/testcontainers/src/common/file-lock.tsalready serialises Ryuk and SSHD startup across processes. The same mechanism fits here.- Related: #1172, where the answer was to use the test runner's global setup. That remains the better fit for one shared container, but
withReuse()is also used to keep containers between runs, where the race still applies. - Reproduced on
main(aa60a746, 12.2.0) with Docker 29.6.1.
Dependencies
- Stack on #1522, #1552: all three rewrite
reuseOrStartContainer.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.6k
- Fork
- 274
- Merge trung bình
- 1 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 44
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của testcontainers/testcontainers-node
-
enhancement minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
testcontainers/testcontainers-node#1539 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
testcontainers/testcontainers-node#1533 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
testcontainers/testcontainers-node#1531 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
testcontainers/testcontainers-node#1529 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
testcontainers/testcontainers-node#1528 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của testcontainers/testcontainers-node
Issue tương tự
-
afk-ok area:data-quality importer size:S
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
enorm-labs/event-junkie#3301 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
one-zero-eight/apply-bot#39 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
bigbluebutton/bbb-ui-components-react#108 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area: app type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
ExpidetGames/code-reviewer#308 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày