[Bug]: TCPForwarderTest fails intermittently on macOS 27.2 after ConnectHandlerRaceTest: loopback connections are reset before accept
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
- 50/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- swift
- Lĩnh vực
- networking, testing
Hướng nghiên cứu
Start with TCPForwarderTest.swift at the reported failure lines and compare testTCPForwarder with ConnectHandlerRaceTest.testRapidConnectDisconnect, the parallel test implicated by the reproduction. Run the supplied filtered SocketForwarderTests command repeatedly, then compare parallel and --no-parallel runs. Done means identifying and addressing the cause so the parallel suite passes reliably without dropping client connections.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have done the following
- I have searched the existing issues
- If possible, I've reproduced the issue using the 'main' branch of this project
Steps to reproduce
Run the SocketForwarderTests target repeatedly on main (16e8d48). The failure is intermittent.
swift test --skip-build -c debug -Xswiftc -warnings-as-errors -Xswiftc -enable-testing --filter SocketForwarderTests
Results on my machine, with the conditions interleaved in blocks:
| Condition | Failures |
|---|---|
TCPForwarderTest alone |
0 / 20 |
TCPForwarderTest|ConnectHandlerRaceTest |
7 / 20 |
SocketForwarderTests |
19 / 40 |
SocketForwarderTests, with the two suites nested under one @Suite(.serialized) parent |
32 / 40 |
Pair, with the stress test pointed at a plain echo listener instead of a TCPForwarder |
8 / 15 |
| Pair, with the stress test opening 100 connections instead of 500 | 4 / 15 |
The samples are small and the machine was under load for some blocks, so the rates are rough. An earlier batch on c05a560 gave 0 / 60 for TCPForwarderTest alone and 0 / 60 with --no-parallel; I have not rerun --no-parallel and can't explain why it differs from the serialized result.
I have only seen this on my own machine. In the CI logs I looked at (macOS 27.0), testTCPForwarder passed while starting at the same moment as testRapidConnectDisconnect.
Problem description
TCPForwarderTest.testTCPForwarder fails intermittently when ConnectHandlerRaceTest.testRapidConnectDisconnect is part of the same test run. The two do not need to overlap: with the suites serialized, the stress test finished first in every run, and testTCPForwarder, started right after it, still failed. It fails in one of two ways.
Some of the 100 clients get no echo back:
✘ Test testTCPForwarder() recorded an issue at TCPForwarderTest.swift:108:13: Expectation failed: sortedResponses[i] == "\(i): success-tcp"
Or a client read fails:
✘ Test testTCPForwarder() recorded an issue at TCPForwarderTest.swift:25:6: Caught error: read(descriptor:pointer:size:): Connection reset by peer) (errno: 54)
With temporary tracing added to the forwarder and the tests, the failing connections die before either listener accepts them:
- Clients that fail with
Connection reset by peerhad connected and written, but the proxy never accepted them;ConnectHandler.channelActivenever ran for those connections. - Clients that get no echo were accepted by the proxy, and the backend
connectsucceeded, but the echo server never accepted that backend connection. The backend read then failed withECONNRESETandGlueHandler.errorCaughtclosed the frontend, which is the intended behaviour. In one failing run, 100 backend connects succeeded, the echo server accepted 76, and the other 24 were reset. - During failing runs,
netstat -Lanshowed the test's own listeners holding 30-50 connections in the incomplete queue for hundreds of milliseconds. Neither listener has more than 100 pending connections, so the backlog (clamped tokern.ipc.somaxconn, 128) is not exceeded.
So the forwarder does not appear to be at fault: it reacts to a backend connection that was reset underneath it. The failure also occurs when the stress test targets a plain listener, with no TCPForwarder on its side at all.
What I can't explain is why loopback connections are reset before accept for a short time after a burst of connect/close on a different listener. I could not read TCP drop counters or capture packets without root, and I have only tested on macOS 27.2.
I don't have a fix to propose. Serializing the suites does not avoid it, and a delay or a retry in the test would only hide it. I'd expect the suite to pass reliably, so I'm leaving this open in case it shows up elsewhere. Feel free to close it if it does not reproduce outside my setup.
Environment
- OS: macOS 27.2 (26B123)
- Xcode: Version 27.2 (27B52)
- Container: main (16e8d48)
Code of Conduct
- I agree to follow this project's Code of Conduct
- Ngôn ngữ chính
- Swift
- Star
- 51.9k
- Fork
- 1.8k
- Merge trung bình
- 2 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 27
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- 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 apple/container
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Kernel download ignores credentials in HTTPS_PROXY and fails with proxyAuthenticationRequiredĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
apple/container#2499 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: `container machine logs -f` exits immediately when the log is emptyCó thể đã có người làm @srivilliamsai đã nhận 5 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
apple/container#2492 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Intermittent failure in PathUtilsTests.testNewDirectoryIsExcludedAndExistingChoiceIsKeptĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
apple/container#2474 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Request]: container ls --filter label=key=valueCó thể đã có người làm @kavix đã nhận 21 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
apple/container#2403 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apple/container
Issue tương tự
-
compiler diagnostics quality ownership SIL ownership
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
T-Defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
element-hq/element-x-ios#6536 ·
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 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Switch to new string APIĐang mởfxios-coreexperience
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
mozilla-mobile/firefox-ios#36661 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
manaflow-ai/cmux#45713 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày