Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Improve CI: disable socket tests on Unix which may fail due to port being in-use#16548

Merged
steveharter merged 1 commit intodotnet:masterfrom
steveharter:FixSocketTest3
Mar 1, 2017
Merged

Improve CI: disable socket tests on Unix which may fail due to port being in-use#16548
steveharter merged 1 commit intodotnet:masterfrom
steveharter:FixSocketTest3

Conversation

@steveharter
Copy link
Contributor

@steveharter steveharter commented Mar 1, 2017

Several Socket tests bind to an open port (returned from the OS), and then connect to that same port but on a different IPV4 or IPV6 loopback address. On Windows that seems to work fine (that other loopback port is never in use), but on Unix (and OSX) port #'s are random (not incremental as in Windows) and it treats IPV4 and IPV6 as separate addresses thus the expected unused port will occasionally be in use causing that test, or related test to fail.

Most likely it is the 'mirror' test that is using the other protocol+port, meaning the test just before or after the current test that for example tests (IPV6, IPV4) while the original tests (IPV4, IPV6). I have repro'd the failures fairly consistently on Ubuntu by adding a 'for' loop to both tests so they execute 1,000 times or so. I have also written a small POSIX example that shows given a bound IPV6 loopback port, the OS can return an IPV4 address with the same port.

This PR just disables these tests for non-Windows cases. Note that these are also the 'failure' tests, meaning the happy path tests (IPV6, IPV6) or (IPV4, IPV4) are not changed here.

Addresses https://github.com/dotnet/corefx/issues/9017, https://github.com/dotnet/corefx/issues/13213
Also https://github.com/dotnet/corefx/issues/14519

cc @stephentoub , @CIPop, @davidsh

@steveharter steveharter added area-System.Net.Sockets test-run-core Test failures in .NET Core test runs labels Mar 1, 2017
@steveharter steveharter self-assigned this Mar 1, 2017
@steveharter steveharter requested review from Priya91 and ianhays March 1, 2017 00:00
@karelz
Copy link
Member

karelz commented Mar 1, 2017

cc @geoffkizer

@karelz
Copy link
Member

karelz commented Mar 1, 2017

@steveharter would it help to make the offending tests exclusive on machine? Or is it overkill?

@stephentoub
Copy link
Member

Are you able to repro the same problematic behavior on Unix with a simple C app, for example, just using the POSIX APIs? I want to make sure the issue isn't actually in the .NET layer.

@steveharter
Copy link
Contributor Author

@stephentoub I sent you a PM with the repro.

@steveharter
Copy link
Contributor Author

test Innerloop Ubuntu14.04 Release Build and Test

@steveharter
Copy link
Contributor Author

steveharter commented Mar 1, 2017

@karelz

would it help to make the offending tests exclusive on machine? Or is it overkill?

Not sure what you mean here. All Windows platforms work here, while all Unix\OSX platforms can fail here.

@karelz
Copy link
Member

karelz commented Mar 1, 2017

I meant can we setup the tests to run in exclusive mode (at least on Linux), so that no other test executes on the VM in parallel?

@steveharter
Copy link
Contributor Author

I meant can we setup the tests to run in exclusive mode (at least on Linux), so that no other test executes on the VM in parallel?

I see. Yes I think that would be overkill. I don't know of a good way to do that other than to create a new test assembly with [assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = true, MaxParallelThreads = 1)].

Another approach is to run all such colliding tests in one test.

Either way, I think these tests are flawed. Any other process (test or not) with one of the ports in use (that are not expected to be in use) can cause these types of tests to fail. Even in rare cases on Windows.

@steveharter steveharter merged commit b5d0f48 into dotnet:master Mar 1, 2017
@steveharter steveharter deleted the FixSocketTest3 branch March 1, 2017 21:55
@karelz
Copy link
Member

karelz commented Mar 1, 2017

@mellinoe is there a way to annotate a test to run exclusively without it being in separate test assembly?

@mellinoe
Copy link
Contributor

mellinoe commented Mar 1, 2017

@karelz I don't think so.

@karelz
Copy link
Member

karelz commented Mar 1, 2017

bummer :( thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Net.Sockets test-run-core Test failures in .NET Core test runs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants