-
Notifications
You must be signed in to change notification settings - Fork 523
Conversation
|
||
var processInfo = new ProcessStartInfo | ||
{ | ||
FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "cmd.exe" : "bash", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well using sh instead of bash since the former is required by POSIX even if it happens to be bash.
@dotnet-bot test Windows Debug x64 Build |
7336c74
to
6a852fd
Compare
@dotnet-bot test OSX 10.12 Debug x64 Build |
6a852fd
to
6581290
Compare
6581290
to
bf9f09e
Compare
Hm, VI works on linux but not mac. I may call that good enough for this test and skip Mac. |
bf9f09e
to
9adf76c
Compare
@dotnet-bot test Windows Debug x64 Build |
|
||
namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests | ||
{ | ||
[OSSkipCondition(OperatingSystems.MacOSX)] // Not applicable, and vi doesn't work there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure handle inheritance isn't an issue on macOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the corefx issue was clear that this is only an issue for Windows.
namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests | ||
{ | ||
[OSSkipCondition(OperatingSystems.MacOSX)] // Not applicable, and vi doesn't work there. | ||
public class HandleInheritanceTest : TestApplicationErrorLoggerLoggedTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: HandleInheritanceTests
3593ed4
to
84fde9d
Compare
Hmm, the Listen test consistently fails on Mac Sockets, and the Connection test is flaky on Windows Libuv. |
Ok, I tracked down the Mac issue. The linux equivilent of what we did on windows is https://legacy.python.org/dev/peps/pep-0433/#socket-socket I'm going to go back to skipping this test on Mac since we don't have a way to fix it there. Still need to figure out what's flaky with Windows Libuv. |
84fde9d
to
14cc039
Compare
On mac and Linux corefx does this by default: https://github.com/dotnet/corefx/blob/master/src/Native/Unix/System.Native/pal_networking.c#L1292-L1307 Perhaps corefx should do this for Windows sockets too? |
@tmds what's the expected behavior of FD_CLOEXEC? From the name it sounds like close-on-process-exit. It isn't working in my Mac tests (currently disabled). Note my tests don't close the parent process, only the socket in the parent process. |
Cloexec causes the handle not to be inherited by child processes. Exec refers to the system call to execute a program. When the child process execs, that handle is closed for the child. |
Ah, but the duplicated handle remains open in the parent process even if I close the original Socket? That would explain why it's not working on Mac, but doesn't explain why Linux is working. |
The listen socket is not duplicated to the children, so when the parent closes it, the server is no longer accepting connections. That explains why it works on Linux. I don't know why it doesn't work on Mac. Mac has limited cloexec apis compared to Linux. Maybe some things are not really supported. For Windows, I think it makes sense that corefx sockets also by default would not be inherited by children. |
14cc039
to
916f352
Compare
916f352
to
d3f2ca9
Compare
Updated. I've removed the flaky connected socket test, we're not modifying that scenario and the flakiness seems to be unrelated. The listen test is disabled for Mac. Note this is considered to be a temporary mitigation. I'll follow up with corefx for a more comprehensive xplat fix in 3.0. |
#2789 If the accept socket's handle gets inherited by child processes, then it's not fully closed until all of the child processes are closed.
Connected sockets don't seem to be affected.