From 8e1afc67f6cf7cb99721918e61fefa54b7c97218 Mon Sep 17 00:00:00 2001 From: Ramon Smits Date: Mon, 21 Sep 2015 13:11:47 +0200 Subject: [PATCH 1/2] Fix for memory leak (issue #90) that seems to occur with .net framework prior to v4.6 caused by using multiple `ContinueWith` continuations and a `CancellationToken`. Issue details here: https://stackoverflow.com/questions/30029462/net-tpl-cancellationtoken-memory-leak --- src/NServiceBus.SqlServer/AdaptiveExecutor.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/NServiceBus.SqlServer/AdaptiveExecutor.cs b/src/NServiceBus.SqlServer/AdaptiveExecutor.cs index 45edc4b9e..1f68d3955 100644 --- a/src/NServiceBus.SqlServer/AdaptiveExecutor.cs +++ b/src/NServiceBus.SqlServer/AdaptiveExecutor.cs @@ -44,18 +44,18 @@ void StartTask() var taskId = Guid.NewGuid(); var receiveTask = Task.Factory .StartNew(ReceiveLoop, null, token, TaskCreationOptions.LongRunning, TaskScheduler.Default) - .ContinueWith(t => + .ContinueWith((t, s) => { - t.Exception.Handle(ex => + if (t.IsFaulted) { - HandleException(ex); - circuitBreaker.Failure(ex); - return true; - }); + t.Exception.Handle(ex => + { + HandleException(ex); + circuitBreaker.Failure(ex); + return true; + }); + } - }, token, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Default) - .ContinueWith((_, s) => - { taskTracker.Forget((Guid)s); if (!taskTracker.ShouldStartAnotherTaskImmediately) From 464a56bc8e9c4e4336a6cf2fe92ffba0d34d074a Mon Sep 17 00:00:00 2001 From: Ramon Smits Date: Tue, 22 Sep 2015 14:03:39 +0200 Subject: [PATCH 2/2] Updated Fody package v1.24.0 => 1.29.3 as this is required by the build server. --- src/NServiceBus.SqlServer/NServiceBus.SqlServer.csproj | 8 ++++---- src/NServiceBus.SqlServer/packages.config | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/NServiceBus.SqlServer/NServiceBus.SqlServer.csproj b/src/NServiceBus.SqlServer/NServiceBus.SqlServer.csproj index 1029f20cd..f0d713873 100644 --- a/src/NServiceBus.SqlServer/NServiceBus.SqlServer.csproj +++ b/src/NServiceBus.SqlServer/NServiceBus.SqlServer.csproj @@ -15,7 +15,7 @@ $(SolutionDir)NServiceBus.snk ..\ - 3ead7d6a + 6113ccb8 true @@ -130,15 +130,15 @@ - + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + - \ No newline at end of file + diff --git a/src/NServiceBus.SqlServer/packages.config b/src/NServiceBus.SqlServer/packages.config index acae12b57..8da7c6068 100644 --- a/src/NServiceBus.SqlServer/packages.config +++ b/src/NServiceBus.SqlServer/packages.config @@ -1,6 +1,6 @@  - +