Verifies that remote links will trigger an `ExitedEvent` if the link fails during socket creation. The test instigates a socket creation failure by hogging all available file descriptors. TODO(andschwa): Enable this test. The current logic will not work on Windows as " The Microsoft Winsock provider limits the maximum number of sockets supported only by available memory on the local computer." Se
| 1066 | // |
| 1067 | // https://docs.microsoft.com/en-us/windows/desktop/WinSock/maximum-number-of-sockets-supported-2 // NOLINT(whitespace/line_length) |
| 1068 | TEST_F_TEMP_DISABLED_ON_WINDOWS(ProcessRemoteLinkTest, RemoteLinkLeak) |
| 1069 | { |
| 1070 | RemoteLinkTestProcess relinker(pid); |
| 1071 | Future<UPID> relinkerExitedPid; |
| 1072 | |
| 1073 | EXPECT_CALL(relinker, exited(pid)) |
| 1074 | .WillOnce(FutureArg<0>(&relinkerExitedPid)); |
| 1075 | |
| 1076 | spawn(relinker); |
| 1077 | |
| 1078 | // Open enough sockets to fill up all available FDs. |
| 1079 | vector<Socket> fdHogs; |
| 1080 | while (true) { |
| 1081 | Try<Socket> hog = Socket::create(); |
| 1082 | |
| 1083 | if (hog.isError()) { |
| 1084 | break; |
| 1085 | } |
| 1086 | |
| 1087 | fdHogs.push_back(hog.get()); |
| 1088 | } |
| 1089 | |
| 1090 | relinker.linkup(); |
| 1091 | |
| 1092 | AWAIT_ASSERT_EQ(pid, relinkerExitedPid); |
| 1093 | |
| 1094 | terminate(relinker); |
| 1095 | wait(relinker); |
| 1096 | } |
| 1097 | |
| 1098 | |
| 1099 | namespace process { |