From 32d380a05801bda255bbf9d758298b8285e52ea5 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Thu, 2 Aug 2018 09:09:25 -0700 Subject: [PATCH 1/4] Don't send WebSocketCloseStatus.Empty, it's invalid (#2716) --- test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs b/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs index 6062003ce7..fc91abb899 100644 --- a/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs +++ b/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs @@ -118,10 +118,11 @@ namespace Microsoft.AspNetCore.SignalR.Tests Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray()); logger.LogInformation("Closing socket"); - await ws.CloseOutputAsync(WebSocketCloseStatus.Empty, "", CancellationToken.None).OrTimeout(); + await ws.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None).OrTimeout(); logger.LogInformation("Waiting for close"); result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout(); Assert.Equal(WebSocketMessageType.Close, result.MessageType); + Assert.Equal(WebSocketCloseStatus.NormalClosure, result.CloseStatus); logger.LogInformation("Closed socket"); } } @@ -156,10 +157,11 @@ namespace Microsoft.AspNetCore.SignalR.Tests Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray()); logger.LogInformation("Closing socket"); - await ws.CloseOutputAsync(WebSocketCloseStatus.Empty, "", CancellationToken.None).OrTimeout(); + await ws.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None).OrTimeout(); logger.LogInformation("Waiting for close"); result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout(); Assert.Equal(WebSocketMessageType.Close, result.MessageType); + Assert.Equal(WebSocketCloseStatus.NormalClosure, result.CloseStatus); logger.LogInformation("Closed socket"); } } From 1358d5a07ed95bb26c75b4c5004e94ad02c4f4b8 Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Thu, 2 Aug 2018 13:00:06 -0700 Subject: [PATCH 2/4] remove Jenkins configs already covered by VSTS (#2706) (#2723) --- build/buildpipeline/linux.groovy | 1 - build/buildpipeline/osx.groovy | 14 -------------- build/buildpipeline/pipeline.groovy | 8 -------- 3 files changed, 23 deletions(-) delete mode 100644 build/buildpipeline/linux.groovy delete mode 100644 build/buildpipeline/osx.groovy diff --git a/build/buildpipeline/linux.groovy b/build/buildpipeline/linux.groovy deleted file mode 100644 index 791d923d0c..0000000000 --- a/build/buildpipeline/linux.groovy +++ /dev/null @@ -1 +0,0 @@ -@Library('dotnet-ci') _ diff --git a/build/buildpipeline/osx.groovy b/build/buildpipeline/osx.groovy deleted file mode 100644 index 5dfa3d8a48..0000000000 --- a/build/buildpipeline/osx.groovy +++ /dev/null @@ -1,14 +0,0 @@ -@Library('dotnet-ci') _ - -// 'node' indicates to Jenkins that the enclosed block runs on a node that matches -// the label 'windows-with-vs' -simpleNode('OSX.1012.Amd64.Open') { - stage ('Checking out source') { - checkout scm - } - stage ('Build') { - def logFolder = getLogFolder() - def environment = "export ASPNETCORE_TEST_LOG_DIR=${WORKSPACE}/${logFolder}" - sh "${environment}&./build.sh -ci" - } -} diff --git a/build/buildpipeline/pipeline.groovy b/build/buildpipeline/pipeline.groovy index c6c4098d3a..76c23615e8 100644 --- a/build/buildpipeline/pipeline.groovy +++ b/build/buildpipeline/pipeline.groovy @@ -2,8 +2,6 @@ import org.dotnet.ci.pipelines.Pipeline def windowsPipeline = Pipeline.createPipeline(this, 'build/buildpipeline/windows.groovy') def windowsESPipeline = Pipeline.createPipeline(this, 'build/buildpipeline/windows-es.groovy') -def linuxPipeline = Pipeline.createPipeline(this, 'build/buildpipeline/linux.groovy') -def osxPipeline = Pipeline.createPipeline(this, 'build/buildpipeline/osx.groovy') String configuration = 'Release' def parameters = [ 'Configuration': configuration @@ -14,9 +12,3 @@ windowsPipeline.triggerPipelineOnGithubPush(parameters) windowsESPipeline.triggerPipelineOnEveryGithubPR("Windows ${configuration} Spanish Language x64 Build", parameters) windowsESPipeline.triggerPipelineOnGithubPush(parameters) - -linuxPipeline.triggerPipelineOnEveryGithubPR("Ubuntu 16.04 ${configuration} Build", parameters) -linuxPipeline.triggerPipelineOnGithubPush(parameters) - -osxPipeline.triggerPipelineOnEveryGithubPR("OSX 10.12 ${configuration} Build", parameters) -osxPipeline.triggerPipelineOnGithubPush(parameters) From 90606338fb60b6c5bff3231bb1c2390e3ed48cdd Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Thu, 2 Aug 2018 15:21:24 -0700 Subject: [PATCH 3/4] Log when closing connection due to timeout (#2722) --- .../HubConnectionContext.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Microsoft.AspNetCore.SignalR.Core/HubConnectionContext.cs b/src/Microsoft.AspNetCore.SignalR.Core/HubConnectionContext.cs index a67fa133df..98583d9903 100644 --- a/src/Microsoft.AspNetCore.SignalR.Core/HubConnectionContext.cs +++ b/src/Microsoft.AspNetCore.SignalR.Core/HubConnectionContext.cs @@ -502,6 +502,7 @@ namespace Microsoft.AspNetCore.SignalR { if (!_receivedMessageThisInterval) { + Log.ClientTimeout(_logger, TimeSpan.FromTicks(_clientTimeoutInterval)); Abort(); } @@ -560,6 +561,9 @@ namespace Microsoft.AspNetCore.SignalR private static readonly Action _abortFailed = LoggerMessage.Define(LogLevel.Trace, new EventId(8, "AbortFailed"), "Abort callback failed."); + private static readonly Action _clientTimeout = + LoggerMessage.Define(LogLevel.Debug, new EventId(9, "ClientTimeout"), "Client timeout ({ClientTimeout}ms) elapsed without receiving a message from the client. Closing connection."); + public static void HandshakeComplete(ILogger logger, string hubProtocol) { _handshakeComplete(logger, hubProtocol, null); @@ -599,6 +603,11 @@ namespace Microsoft.AspNetCore.SignalR { _abortFailed(logger, exception); } + + public static void ClientTimeout(ILogger logger, TimeSpan timeout) + { + _clientTimeout(logger, (int)timeout.TotalMilliseconds, null); + } } } } From 810c7cf9ad70d2a12708826100127a085b556a7f Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Thu, 2 Aug 2018 15:24:26 -0700 Subject: [PATCH 4/4] Fix ODE race with cancellationtokensource (#2721) --- .../Internal/HttpConnectionDispatcher.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.Http.Connections/Internal/HttpConnectionDispatcher.cs b/src/Microsoft.AspNetCore.Http.Connections/Internal/HttpConnectionDispatcher.cs index 015bf22846..f8c33e051f 100644 --- a/src/Microsoft.AspNetCore.Http.Connections/Internal/HttpConnectionDispatcher.cs +++ b/src/Microsoft.AspNetCore.Http.Connections/Internal/HttpConnectionDispatcher.cs @@ -314,8 +314,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal connection.Status = HttpConnectionStatus.Inactive; - // Dispose the cancellation token - connection.Cancellation?.Dispose(); + connection.Cancellation?.Cancel(); connection.Cancellation = null; }