Skip to content

Commit e05f6a9

Browse files
authored
TcpReceiveSendGetsCanceledByDispose: fix test timing out with latest RHEL7 kernel (#52833)
The timeout on this test is less than the accumulated delay on retries, which causes the test to timeout on a RHEL7 system that has the kernel bug fixed.
1 parent 31345ae commit e05f6a9

File tree

1 file changed

+5
-4
lines changed
  • src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive

1 file changed

+5
-4
lines changed

src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive/SendReceive.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,8 +1003,9 @@ public async Task TcpReceiveSendGetsCanceledByDispose(bool receiveOrSend, bool i
10031003
{
10041004
// RHEL7 kernel has a bug preventing close(AF_UNKNOWN) to succeed with IPv6 sockets.
10051005
// In this case Dispose will trigger a graceful shutdown, which means that receive will succeed on socket2.
1006+
// This bug is fixed in kernel 3.10.0-1160.25+.
10061007
// TODO: Remove this, once CI machines are updated to a newer kernel.
1007-
bool expectGracefulShutdown = UsesSync && PlatformDetection.IsRedHatFamily7 && receiveOrSend && (ipv6Server || dualModeClient);
1008+
bool mayShutdownGraceful = UsesSync && PlatformDetection.IsRedHatFamily7 && receiveOrSend && (ipv6Server || dualModeClient);
10081009

10091010
// We try this a couple of times to deal with a timing race: if the Dispose happens
10101011
// before the operation is started, the peer won't see a ConnectionReset SocketException and we won't
@@ -1092,17 +1093,17 @@ await RetryHelper.ExecuteAsync(async () =>
10921093
}
10931094
}
10941095

1095-
if (!expectGracefulShutdown)
1096+
try
10961097
{
10971098
Assert.Equal(SocketError.ConnectionReset, peerSocketError);
10981099
}
1099-
else
1100+
catch when (mayShutdownGraceful)
11001101
{
11011102
Assert.Null(peerSocketError);
11021103
}
11031104
}
11041105
}
1105-
}, maxAttempts: 10, retryWhen: e => e is XunitException);
1106+
}, maxAttempts: 8, retryWhen: e => e is XunitException);
11061107
}
11071108

11081109
[Fact]

0 commit comments

Comments
 (0)