swift-nio
swift-nio copied to clipboard
flaky test NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError
01:08:06 - Test Case '-[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError]' started.
01:08:06 - /otmp/od.EmaUmP/lw.aOK3Ll/metk-pjn0r1n6sjqg2_0-44506/t.MFCPHF/0~dBjA6PWV81-cALuO4PchwK94jFfLgiBMXgZLvKA4PYzOxn7ZaYq0Hg3ilPlwO5yIY6_2yDOBqabK9rbQafx9CA==/SRCROOT/Tests/NIOTests/SocketChannelTest.swift:580: error: -[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError] : failed - Should not accept a Channel but got SocketChannel { BaseSocket { fd=122 }, active = false, localAddress = Optional([IPv4]127.0.0.1/127.0.0.1:59348), remoteAddress = nil }
01:08:06 - /otmp/od.EmaUmP/lw.aOK3Ll/metk-pjn0r1n6sjqg2_0-44506/t.MFCPHF/0~dBjA6PWV81-cALuO4PchwK94jFfLgiBMXgZLvKA4PYzOxn7ZaYq0Hg3ilPlwO5yIY6_2yDOBqabK9rbQafx9CA==/SRCROOT/Tests/NIOTests/SocketChannelTest.swift:613: error: -[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError] : failed - unexpected error inappropriateOperationForState thrown
01:08:06 - <unknown>:0: error: -[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError] : failed: caught error: The operation couldn’t be completed. (NIO.ChannelError error 15.)
01:08:06 - Test Case '-[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError]' failed (0.128 seconds).
the race is here:
1 let clientSocket = try assertNoThrowWithValue(Socket(protocolFamily: AF_INET, type: Posix.SOCK_STREAM))
2 XCTAssertNoThrow(try clientSocket.setOption(level: SOL_SOCKET, name: SO_LINGER, value: linger(l_onoff: 1, l_linger: 0)))
3 XCTAssertNoThrow(try clientSocket.connect(to: serverChannel.localAddress!))
4 XCTAssertNoThrow(try clientSocket.close())
5
6 // Trigger accept() in the server
7 serverChannel.read()
The expectation is that when close
(line 4) completes that the other end has received this RST
packet. Unfortunately, this RST packet is racing the read
call on line 7.
- Seen again 2020-08-21 (by @PeterAdams-A )
- Seen again 2021-01-08 (by @weissi )
2021-01-08 17:07:38.851 - Test Case '-[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError]' started.
2021-01-08 17:07:38.851 - /otmp/od.qelLUc/lw.NU57YA/ejii-8kio2i0q1kutv_3-4240075/t.B18kmM/0~CUHpLPaKStdVvnQdFKVTIo7YMJbd2lKfexctUXWlDksAz1Ftf2VShCKQXfvldOnvAYufzpx5MTCvrGe1CAgoIw==/SRCROOT/Tests/NIOTests/SocketChannelTest.swift:564: error: -[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError] : failed - Should not accept a Channel but got SocketChannel { BaseSocket { fd=11 }, active = false, localAddress = Optional([IPv4]127.0.0.1/127.0.0.1:55205), remoteAddress = Optional([IPv4]127.0.0.1/127.0.0.1:55206) }
2021-01-08 17:07:38.851 - /otmp/od.qelLUc/lw.NU57YA/ejii-8kio2i0q1kutv_3-4240075/t.B18kmM/0~CUHpLPaKStdVvnQdFKVTIo7YMJbd2lKfexctUXWlDksAz1Ftf2VShCKQXfvldOnvAYufzpx5MTCvrGe1CAgoIw==/SRCROOT/Tests/NIOTests/SocketChannelTest.swift:598: error: -[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError] : XCTAssertTrue failed
2021-01-08 17:07:38.851 - Test Case '-[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError]' failed (0.041 seconds).
2021-03-08 03:07:14.086 - Test Case '-[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError]' started.
2021-03-08 03:07:14.086 - /otmp/od.cPOtMK/lw.RZB6Ic/2ymv-t905gok0qjf8e_8-1488546/t.Bkp2pQ/0~TKNECaqDrAPA0Mub3f8Zj6UU0KBa_S6GLcZGxcqCqxB-pfOmS1BorbW8qs7cRyHN25V-4mQGdvI4iAFqdlkJ8Q==/SRCROOT/Tests/NIOTests/SocketChannelTest.swift:564: error: -[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError] : failed - Should not accept a Channel but got SocketChannel { BaseSocket { fd=11 }, active = false, localAddress = Optional([IPv4]127.0.0.1/127.0.0.1:60833), remoteAddress = Optional([IPv4]127.0.0.1/127.0.0.1:60834) }
2021-03-08 03:07:14.086 - /otmp/od.cPOtMK/lw.RZB6Ic/2ymv-t905gok0qjf8e_8-1488546/t.Bkp2pQ/0~TKNECaqDrAPA0Mub3f8Zj6UU0KBa_S6GLcZGxcqCqxB-pfOmS1BorbW8qs7cRyHN25V-4mQGdvI4iAFqdlkJ8Q==/SRCROOT/Tests/NIOTests/SocketChannelTest.swift:598: error: -[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError] : XCTAssertTrue failed
2021-03-08 03:07:14.086 - Test Case '-[NIOTests.SocketChannelTest testInstantTCPConnectionResetThrowsError]' failed (0.009 seconds).