From c58bcbfea3b18587ea50ef4814ad74e56e6cf9fa Mon Sep 17 00:00:00 2001 From: Max Kerr Date: Thu, 12 Apr 2018 09:45:23 -0700 Subject: [PATCH 1/2] Document issue in Preview 2 with SocketsHttpHandler on single core machines. --- .../Preview/2.1.0-preview2-known-issues.md | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/release-notes/2.1/Preview/2.1.0-preview2-known-issues.md b/release-notes/2.1/Preview/2.1.0-preview2-known-issues.md index 54caf9ae..dbde8e6a 100644 --- a/release-notes/2.1/Preview/2.1.0-preview2-known-issues.md +++ b/release-notes/2.1/Preview/2.1.0-preview2-known-issues.md @@ -26,4 +26,24 @@ We have temporarily removed the Preview 2 installers from the Linux package feed ```bash sudo apt install dotnet-host=2.0.6-1 -``` \ No newline at end of file +``` + +## SocketsHttpHandler hangs on single core machines + +There is an issue with the new default HttpClientHandler that will cause hangs on single core machines when multiple connections are opened simultaneously. [corefx/issues/28979](https://github.com/dotnet/corefx/issues/28979). This issue has since been fixed, but is present in the Preview 2 build. + +**Workaround** - Disable SocketsHttpHandler as the default, and fall back to the platform handler. + +From code, use the AppContext class: + +```csharp +AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false); +``` + +The AppContext switch can also be set by config file. + +The same can be achieved via the environment variable DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER. To opt out, set the value to either false or 0. + +On Windows, you can choose to use WinHttpHandler or SocketsHttpHandler on a call-by-call basis. To do that, instantiate one of those types and then pass it to HttpClient when you instantiate it. + +On Linux and macOS, you can only configure HttpClient on a process-basis. On Linux, you need to deploy libcurl yourself if you want to use the old HttpClient implementation. If you have .NET Core 2.0 working on your machine, then libcurl is already installed. \ No newline at end of file From 3fa1afed9b1085b355a8664ab3fb544b496849b1 Mon Sep 17 00:00:00 2001 From: Max Kerr Date: Thu, 12 Apr 2018 10:36:28 -0700 Subject: [PATCH 2/2] Reword workaround. --- .../2.1/Preview/2.1.0-preview2-known-issues.md | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/release-notes/2.1/Preview/2.1.0-preview2-known-issues.md b/release-notes/2.1/Preview/2.1.0-preview2-known-issues.md index dbde8e6a..66736772 100644 --- a/release-notes/2.1/Preview/2.1.0-preview2-known-issues.md +++ b/release-notes/2.1/Preview/2.1.0-preview2-known-issues.md @@ -32,18 +32,4 @@ sudo apt install dotnet-host=2.0.6-1 There is an issue with the new default HttpClientHandler that will cause hangs on single core machines when multiple connections are opened simultaneously. [corefx/issues/28979](https://github.com/dotnet/corefx/issues/28979). This issue has since been fixed, but is present in the Preview 2 build. -**Workaround** - Disable SocketsHttpHandler as the default, and fall back to the platform handler. - -From code, use the AppContext class: - -```csharp -AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false); -``` - -The AppContext switch can also be set by config file. - -The same can be achieved via the environment variable DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER. To opt out, set the value to either false or 0. - -On Windows, you can choose to use WinHttpHandler or SocketsHttpHandler on a call-by-call basis. To do that, instantiate one of those types and then pass it to HttpClient when you instantiate it. - -On Linux and macOS, you can only configure HttpClient on a process-basis. On Linux, you need to deploy libcurl yourself if you want to use the old HttpClient implementation. If you have .NET Core 2.0 working on your machine, then libcurl is already installed. \ No newline at end of file +**Workaround** - Use a machine with 2+ cores, or enable the older platform specific HttpClientHandler ([as described in the Preview 2 blog post](https://blogs.msdn.microsoft.com/dotnet/2018/04/11/announcing-net-core-2-1-preview-2/)) \ No newline at end of file