Client-side host port pick collides with ports already in use
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 20/100
Hướng nghiên cứu
Start with GenericContainer's default host port binding and compare it with the daemon allocated port flow described in the issue. Check how getMappedPort() reads NetworkSettings.Ports, then verify that withPortGenerator() still supports fixed ports. Done means the default binding leaves HostPort unset and the mapped port is available after start; pull request #81 is already open for this change.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
GenericContainer picks host ports on its own: RandomUniquePortGenerator takes a random port from 10000–65535 and only checks that nothing accepts connections on localhost:<port>. The port can still be taken between that check and the container start, or be bound without a listener — for example as the local port of an outgoing connection, when the host's ephemeral range overlaps 10000–65535. The start then fails:
Docker\API\Exception\ContainerStartInternalServerErrorException: server error
rootlessport listen tcp 0.0.0.0:16544: bind: address already in use
We hit this a few times a week on a CI host that runs test suites in parallel (rootless Podman, net.ipv4.ip_local_port_range = 10000 65535).
Other Testcontainers implementations leave host port allocation to the daemon: the binding goes out without HostPort, and the mapped port is read from NetworkSettings.Ports after start. getMappedPort() already reads it from inspect, so only the default binding has to change, while withPortGenerator() keeps working for fixed ports.
I'll open a PR with this change.
- Ngôn ngữ chính
- PHP
- Star
- 216
- Fork
- 38
- Merge trung bình
- 1 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không 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-php
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
testcontainers/testcontainers-php#83 · 3 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
testcontainers/testcontainers-php#57 · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
-
WaitForLog timeout too shortĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
Tất cả issue của testcontainers/testcontainers-php
Issue tương tự
-
15.0
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
bug needs-triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
camunda/orchestration-cluster-api-php#162 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Procedure for security issuesĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
TYPO3-Solr/ext-solr#4850 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Hex viewer drops ASCII '0' after a complete rowCó thể đã có người làm @palashranka đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 3 ngày