Fix SubProcess Communicate() for macOS.
On macOS, poll(2) may return POLLNVAL for a valid file descriptor that was closed on its remote side (by the other process) before this process calls poll() the first time. Treat this case as an error. Re-enable the SubProcess tests, one of which (StdinChildExit) appeared flaky on macOS depending on the timing of the child process exiting and the parent process first calling poll(). Change: 139850066
This commit is contained in:
parent
92fef23d53
commit
ecae26fb5c
tensorflow/core
@ -1541,6 +1541,7 @@ tf_cc_tests(
|
||||
"platform/net_test.cc",
|
||||
"platform/port_test.cc",
|
||||
"platform/profile_utils/cpu_utils_test.cc",
|
||||
"platform/subprocess_test.cc",
|
||||
],
|
||||
deps = [
|
||||
":lib",
|
||||
@ -1553,21 +1554,6 @@ tf_cc_tests(
|
||||
],
|
||||
)
|
||||
|
||||
tf_cc_tests(
|
||||
size = "small",
|
||||
srcs = ["platform/subprocess_test.cc"],
|
||||
tags = ["manual"],
|
||||
deps = [
|
||||
":lib",
|
||||
":lib_internal",
|
||||
":lib_test_internal",
|
||||
":protos_all_cc",
|
||||
":test",
|
||||
":test_main",
|
||||
"//third_party/eigen3",
|
||||
],
|
||||
)
|
||||
|
||||
tf_cc_tests(
|
||||
size = "small",
|
||||
srcs = ["platform/env_test.cc"],
|
||||
|
@ -446,7 +446,7 @@ int SubProcess::Communicate(const string* stdin_input, string* stdout_output,
|
||||
fds[i].fd = -1;
|
||||
fd_remain--;
|
||||
}
|
||||
} else if ((fds[i].revents & POLLERR) != 0) {
|
||||
} else if ((fds[i].revents & (POLLERR | POLLNVAL)) != 0) {
|
||||
fds[i].fd = -1;
|
||||
fd_remain--;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user