mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Increase timeout when observing TCP connection failures
Give the Netstack additional time to reject incoming connections for which there are no listening sockets. This prevents flakes in test environments with CPU contention, where the Netstack may be descheduled for multiple seconds. PiperOrigin-RevId: 623165285
This commit is contained in:
@@ -1257,7 +1257,8 @@ PosixErrorOr<FileDescriptor> nonBlockingConnectNoListener(
|
||||
|
||||
// Wait for the connect to fail.
|
||||
struct pollfd poll_fd = {s.get(), POLLERR, 0};
|
||||
EXPECT_THAT(RetryEINTR(poll)(&poll_fd, 1, 1000), SyscallSucceedsWithValue(1));
|
||||
EXPECT_THAT(RetryEINTR(poll)(&poll_fd, 1, kTimeoutMillis),
|
||||
SyscallSucceedsWithValue(1));
|
||||
return std::move(s);
|
||||
}
|
||||
|
||||
@@ -1732,7 +1733,8 @@ TEST_P(SimpleTcpSocketTest, NonBlockingConnectRefused) {
|
||||
// We don't need to specify any events to get POLLHUP or POLLERR as these
|
||||
// are added before the poll.
|
||||
struct pollfd poll_fd = {s.get(), /*events=*/0, 0};
|
||||
EXPECT_THAT(RetryEINTR(poll)(&poll_fd, 1, 1000), SyscallSucceedsWithValue(1));
|
||||
EXPECT_THAT(RetryEINTR(poll)(&poll_fd, 1, kTimeoutMillis),
|
||||
SyscallSucceedsWithValue(1));
|
||||
|
||||
// The ECONNREFUSED should cause us to be woken up with POLLHUP.
|
||||
EXPECT_NE(poll_fd.revents & (POLLHUP | POLLERR), 0);
|
||||
|
||||
Reference in New Issue
Block a user