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

Conversation

@stephentoub
Copy link
Member

This ports all changes to HttpListener since we forked the release/2.0.0 branch on May 17th. We can separately do a clean-up port to address any remaining issues addressed today/tomorrow.

Fixes #20060.
cc: @geoffkizer

hughbe and others added 30 commits May 28, 2017 22:49
* Re-enable failing httplistener tests on osx.

* Fix edge cases in httplistener prefixes.

* Throw exception for all unresolved hostnames.
If the ctor encounters a failure, _processPrefixListener may remain null; then when the factory is Dispose'd, it null refs.  This is taking out a bunch of runs, including almost all macOS runs.
Lack of doing so results in hangs if the IAsyncResult is from a different HttpListener
* Add HttpListenerResponse tests

* Baseline all the managed test failures

* Preliminary PR feedback

- Remove added argument validation
- Split up tests
- Start to investigate fixing race conditions in the tests (this isn't
done yet)

* Baseline all HttpListener disabled tests on Unix

* Use exact number of bytes to avoid race conditions

Fixes failures when I stress test the suit by running the tests 100
times

* Fix interminate test failures discovered by running the tests 100 times

* Fix managed test failures and use overridable ConditionalFact/Theory instead of ActiveIssue

This lets me simulate being on a managed environment on Windows so I can
iterate more rapidly

* Fix Windows 7 outerloop tests
If it doesn't receive the expected amount in the first iteration, it's likely it'll never break out of the loop.  It's also not technically correct with regards to UTF8 handling, but that's unlikely to be an issue with our current tests.
Move the Windows implementation to be shared and remove the managed-specific implementation.
We shouldn't call CheckSentHeaders, as the Windows implementation doesn't.  And once that's removed, it's the same as the Windows implementation and we can move the implementation to shared.
Move the Windows implementation to shared and use it from managed.
Move the Windows implementation to shared and use it from managed.
Move Windows implementation to shared, then use that from managed, which means moving the core of the managed implementation to a private EnsureResponseStream helper.
Move Windows implementation to shared, and rewrite managed implementation to use it.  Remove setting of KeepAlive header, and fix up handling of content length with regards to chunked, Close(..., willBlock:false), etc.
* Add HttpListener authorization tests

* Baseline managed test failures

* Fix non-Windows test failures

I don't know why these are failing but I don't think it's a bug as
Windows and managed share the same code here
stephentoub and others added 17 commits May 28, 2017 23:01
It only currently passes on Windows because the Windows implementation actually does some work, making it unlikely that the test will fail, but still possible.  On Unix, the implementation is a stub and completes synchronously, thereby always failing.
Simply reuse the Windows implementation's cookie handling, moving it to a shared file, calling it from the managed, and removing the managed's implementation.
…res in CI

I've been unable to reliably repro hangs on Unix locally.  As a stand-in, I'm running the managed HttpListener implementation on Windows.  There must be enough differences in timing or client behavior or Socket behavior or whatever to trigger a multitude of hangs/asserts, even though this should work reliably.  Since it's likely that some subset of these tests are the same ones failing in CI, I've temporarily disabled them all, in hopes of getting CI green reliably.  We should aggressively investigate and get these running again; the underlying cause(s) is likely something in the product that would impact real scenarios.  A large chunk of them have to do with chunked encoding, so there's very likely a product issue there; also with establishing web socket connections.
…lure

The managed implementation of HttpListener launches an asynchronous accept loop: each accept spawns the next async accept.  If an async accept fails, for some reason the current code is actually closing the previously accepted connection, which doesn't make sense.  Stop doing that.
- Cleanup some test code
- Add HttpListener web socket tests
- Fix some more Windows porting bugs
- Baseline managed test failures
- Change CopyPrincipal to throw PNSE instead of NotImplementedException
- Fix test attribution to allow "msbuild /t:rebuildandtest" to work with both Windows and managed implementations
- Fix IsWindowsImplementation to recognize both netcoreapp and netfx implementations
- Fix Assert.Equal calls that should be case-insensitive
- Move Get_Disposed_ThrowsObjectDisposedException to also apply to managed implementation
- Remove unnecessary Task disposal in HttpListenerWebSocketTests
- Add missing await of ClientConnectTask in several tests, where the lack of it resulted in sporadic failures due to race conditions
- Replace ReceiveAsync calls with custom ReceiveAllAsync calls where necessary
@stephentoub
Copy link
Member Author

@dotnet-bot help

@dotnet-bot
Copy link

Welcome to the dotnet/corefx Repository

The following is a list of valid commands on this PR. To invoke a command, comment the indicated phrase on the PR

The following commands are valid for all PRs and repositories.

Click to expand
Comment Phrase Action
@dotnet-bot test this please Re-run all legs. Use sparingly
@dotnet-bot test ci please Generates (but does not run) jobs based on changes to the groovy job definitions in this branch
@dotnet-bot help Print this help message

The following jobs are launched by default for each PR against dotnet/corefx:release/2.0.0.

Click to expand
Comment Phrase Job Launched
@dotnet-bot test Windows_NT Debug AllConfigurations Build Windows_NT Debug AllConfigurations Build
@dotnet-bot test Innerloop CentOS7.1 Debug x64 Build and Test Innerloop CentOS7.1 Debug x64 Build and Test
@dotnet-bot test Innerloop CentOS7.1 Release x64 Build and Test Innerloop CentOS7.1 Release x64 Build and Test
@dotnet-bot test Innerloop netfx Windows_NT Debug x86 Build and Test Innerloop netfx Windows_NT Debug x86 Build and Test
@dotnet-bot test Innerloop netfx Windows_NT Release x64 Build and Test Innerloop netfx Windows_NT Release x64 Build and Test
@dotnet-bot test Innerloop OSX10.12 Debug x64 Build and Test Innerloop OSX10.12 Debug x64 Build and Test
@dotnet-bot test Innerloop OSX10.12 Release x64 Build and Test Innerloop OSX10.12 Release x64 Build and Test
@dotnet-bot test Innerloop PortableLinux Debug x64 Build and Test Innerloop PortableLinux Debug x64 Build and Test
@dotnet-bot test Innerloop PortableLinux Release x64 Build and Test Innerloop PortableLinux Release x64 Build and Test
@dotnet-bot test Innerloop Tizen armel Debug Cross Build Innerloop Tizen armel Debug Cross Build
@dotnet-bot test Innerloop Tizen armel Release Cross Build Innerloop Tizen armel Release Cross Build
@dotnet-bot test Vertical uap Build Vertical uap Build
@dotnet-bot test Vertical uapaot Build Vertical uapaot Build
@dotnet-bot test Innerloop Ubuntu14.04 arm Release Cross Build Innerloop Ubuntu14.04 arm Release Cross Build
@dotnet-bot test Innerloop Ubuntu14.04 Debug x64 Build and Test Innerloop Ubuntu14.04 Debug x64 Build and Test
@dotnet-bot test Innerloop Ubuntu14.04 Release x64 Build and Test Innerloop Ubuntu14.04 Release x64 Build and Test
@dotnet-bot test Innerloop Ubuntu16.04 arm Debug Cross Build Innerloop Ubuntu16.04 arm Debug Cross Build
@dotnet-bot test Innerloop Windows_NT Debug x86 Build and Test Innerloop Windows_NT Debug x86 Build and Test
@dotnet-bot test Innerloop Windows_NT Release x64 Build and Test Innerloop Windows_NT Release x64 Build and Test

The following optional jobs are available in PRs against dotnet/corefx:release/2.0.0.

Click to expand
Comment Phrase Job Launched
@dotnet-bot test code coverage Queues Code Coverage Windows Debug
@dotnet-bot test innerloop Debian8.4 Debug Queues Innerloop Debian8.4 Debug x64 Build and Test
@dotnet-bot test innerloop Debian8.4 Release Queues Innerloop Debian8.4 Release x64 Build and Test
@dotnet-bot test innerloop Fedora24 Debug Queues Innerloop Fedora24 Debug x64 Build and Test
@dotnet-bot test innerloop Fedora24 Release Queues Innerloop Fedora24 Release x64 Build and Test
@dotnet-bot test code formatter check Queues Code Formatter Check
@dotnet-bot test innerloop OpenSUSE13.2 Debug Queues Innerloop OpenSUSE13.2 Debug x64 Build and Test
@dotnet-bot test innerloop OpenSUSE13.2 Release Queues Innerloop OpenSUSE13.2 Release x64 Build and Test
@dotnet-bot test innerloop OpenSUSE42.1 Debug Queues Innerloop OpenSUSE42.1 Debug x64 Build and Test
@dotnet-bot test innerloop OpenSUSE42.1 Release Queues Innerloop OpenSUSE42.1 Release x64 Build and Test
@dotnet-bot test outerloop netcoreapp CentOS7.1 Debug Queues OuterLoop netcoreapp CentOS7.1 Debug x64
@dotnet-bot test outerloop netcoreapp CentOS7.1 Release Queues OuterLoop netcoreapp CentOS7.1 Release x64
@dotnet-bot test outerloop netcoreapp Debian8.4 Debug Queues OuterLoop netcoreapp Debian8.4 Debug x64
@dotnet-bot test outerloop netcoreapp Debian8.4 Release Queues OuterLoop netcoreapp Debian8.4 Release x64
@dotnet-bot test outerloop netcoreapp Fedora24 Debug Queues OuterLoop netcoreapp Fedora24 Debug x64
@dotnet-bot test outerloop netcoreapp Fedora24 Release Queues OuterLoop netcoreapp Fedora24 Release x64
@dotnet-bot test outerloop netcoreapp OpenSUSE13.2 Debug Queues OuterLoop netcoreapp OpenSUSE13.2 Debug x64
@dotnet-bot test outerloop netcoreapp OpenSUSE13.2 Release Queues OuterLoop netcoreapp OpenSUSE13.2 Release x64
@dotnet-bot test outerloop netcoreapp OpenSUSE42.1 Debug Queues OuterLoop netcoreapp OpenSUSE42.1 Debug x64
@dotnet-bot test outerloop netcoreapp OpenSUSE42.1 Release Queues OuterLoop netcoreapp OpenSUSE42.1 Release x64
@dotnet-bot test outerloop netcoreapp OSX10.12 Debug Queues OuterLoop netcoreapp OSX10.12 Debug x64
@dotnet-bot test outerloop netcoreapp OSX10.12 Release Queues OuterLoop netcoreapp OSX10.12 Release x64
@dotnet-bot test outerloop netcoreapp PortableLinux Debug Queues OuterLoop netcoreapp PortableLinux Debug x64
@dotnet-bot test outerloop netcoreapp PortableLinux Release Queues OuterLoop netcoreapp PortableLinux Release x64
@dotnet-bot test outerloop netcoreapp RHEL7.2 Debug Queues OuterLoop netcoreapp RHEL7.2 Debug x64
@dotnet-bot test outerloop netcoreapp RHEL7.2 Release Queues OuterLoop netcoreapp RHEL7.2 Release x64
@dotnet-bot test outerloop netcoreapp Ubuntu14.04 Debug Queues OuterLoop netcoreapp Ubuntu14.04 Debug x64
@dotnet-bot test outerloop netcoreapp Ubuntu14.04 Release Queues OuterLoop netcoreapp Ubuntu14.04 Release x64
@dotnet-bot test outerloop netcoreapp Ubuntu16.04 Debug Queues OuterLoop netcoreapp Ubuntu16.04 Debug x64
@dotnet-bot test outerloop netcoreapp Ubuntu16.04 Release Queues OuterLoop netcoreapp Ubuntu16.04 Release x64
@dotnet-bot test outerloop netcoreapp Ubuntu16.10 Debug Queues OuterLoop netcoreapp Ubuntu16.10 Debug x64
@dotnet-bot test outerloop netcoreapp Ubuntu16.10 Release Queues OuterLoop netcoreapp Ubuntu16.10 Release x64
@dotnet-bot test outerloop netcoreapp Windows 10 Debug Queues OuterLoop netcoreapp Windows 10 Debug x64
@dotnet-bot test outerloop netcoreapp Windows 10 Release Queues OuterLoop netcoreapp Windows 10 Release x64
@dotnet-bot test outerloop netcoreapp Windows 7 Debug Queues OuterLoop netcoreapp Windows 7 Debug x64
@dotnet-bot test outerloop netcoreapp Windows 7 Release Queues OuterLoop netcoreapp Windows 7 Release x64
@dotnet-bot test outerloop netcoreapp Windows_NT Debug Queues OuterLoop netcoreapp Windows_NT Debug x64
@dotnet-bot test outerloop netcoreapp Windows_NT Release Queues OuterLoop netcoreapp Windows_NT Release x64
@dotnet-bot test outerloop netfx Windows_NT Debug Queues OuterLoop netfx Windows_NT Debug x64
@dotnet-bot test outerloop netfx Windows_NT Release Queues OuterLoop netfx Windows_NT Release x64
@dotnet-bot test outerloop Windows Nano 2016 Debug Queues OuterLoop Windows Nano 2016 Debug
@dotnet-bot test outerloop Windows Nano 2016 Release Queues OuterLoop Windows Nano 2016 Release
@dotnet-bot test innerloop RHEL7.2 Debug Queues Innerloop RHEL7.2 Debug x64 Build and Test
@dotnet-bot test innerloop RHEL7.2 Release Queues Innerloop RHEL7.2 Release x64 Build and Test
@dotnet-bot test innerloop Ubuntu14.04 arm Debug Queues Innerloop Ubuntu14.04 arm Debug Cross Build
@dotnet-bot test innerloop Ubuntu16.04 arm Release Queues Innerloop Ubuntu16.04 arm Release Cross Build
@dotnet-bot test innerloop Ubuntu16.04 Debug Queues Innerloop Ubuntu16.04 Debug x64 Build and Test
@dotnet-bot test innerloop Ubuntu16.04 Release Queues Innerloop Ubuntu16.04 Release x64 Build and Test
@dotnet-bot test innerloop Ubuntu16.10 Debug Queues Innerloop Ubuntu16.10 Debug x64 Build and Test
@dotnet-bot test innerloop Ubuntu16.10 Release Queues Innerloop Ubuntu16.10 Release x64 Build and Test

Have a nice day!

@stephentoub
Copy link
Member Author

@dotnet-bot test outerloop netfx Windows_NT Debug
@dotnet-bot test outerloop netcoreapp Windows 10 Debug
@dotnet-bot test outerloop netcoreapp OSX10.12 Debug
@dotnet-bot test outerloop netcoreapp Ubuntu16.10 Debug
@dotnet-bot test outerloop netcoreapp PortableLinux Debug

@geoffkizer
Copy link

LGTM

@stephentoub stephentoub added this to the 2.0.0 milestone May 29, 2017
@stephentoub
Copy link
Member Author

@dotnet-bot test OuterLoop netfx Windows_NT Debug x64 please (https://github.com/dotnet/corefx/issues/11737)

@geoffkizer
Copy link

@dotnet-bot test OuterLoop netfx Windows_NT Debug x64 please

@stephentoub stephentoub merged commit 402d1ef into dotnet:release/2.0.0 May 29, 2017
@stephentoub stephentoub deleted the port_listener branch May 29, 2017 11:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants