MiniProfiler Timing memory leaks in applicazione ASP.NET C# MVC

di il
6 risposte

MiniProfiler Timing memory leaks in applicazione ASP.NET C# MVC

Ciao,

ho memory leaks sul tipo string allocato dall'oggetto MiniProfiler.Timing. 
Su grosse moli di thread mi fa “scoppriare” la web app, scritta in c# ASP.NET MVB, .NET 6.0.

Eccovi una schermata parlante di dotMemory :

Anche forzando il GC la memoria non si dealloca.
L'utilizzo tipico che ne faccio è il seguente :

  using (MiniProfiler.Current.CustomTiming("http", $"POST {endpoint}"))
  {
      // Code       
  }

Come posso risolvere il problema?
Grazie,

Simone

6 Risposte

  • Re: MiniProfiler Timing memory leaks in applicazione ASP.NET C# MVC

    11/03/2023 - sspagnamn76 ha scritto:


    Su grosse moli di thread mi fa “scoppriare” la web app

    Quanto sono “grosse” queste moli di thread?

  • Re: MiniProfiler Timing memory leaks in applicazione ASP.NET C# MVC

    Ciao colleghi, rispondo ad entrambi.

    1. Togliendo Miniprofiler i leak sulle stringhe spariscono. Sto valutando con la committente cosa fare.
    2. 10.000 thread con 500 thread in parallelo.

    L'applicazione di test fa così :

    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Net.Http;
    using System.Threading.Tasks;
    namespace StressTestGaming
    {
       class Program
       {
           static async Task Main(string[] args)
           {
               // Configuration options
               int numRequests = 10000; // Total number of requests to send
               int concurrencyLevel = 500; // Number of requests to send simultaneously
               string url = "https://localhost:44332/"; // URL to request
               // Create a list to hold the tasks for each request
               var tasks = new List<Task>();
               // Create an HTTP client to send the requests
               var httpClient = new HttpClient();
               // Create a stopwatch to measure the total time taken
               var stopwatch = Stopwatch.StartNew();
               // Start sending the requests in batches
               for (int i = 0; i < numRequests; i += concurrencyLevel)
               {
                   Console.WriteLine($"Processing request number {i}");
                   // Create a batch of requests to send simultaneously
                   var batchTasks = new List<Task>();
                   for (int j = 0; j < concurrencyLevel && i + j < numRequests; j++)
                   {
                       batchTasks.Add(httpClient.GetAsync(url));
                   }
                   // Wait for all the requests in the batch to complete
                   await Task.WhenAll(batchTasks);
                   // Add the batch tasks to the overall task list
                   tasks.AddRange(batchTasks);
               }
               // Wait for all the requests to complete
               await Task.WhenAll(tasks);
               // Stop the stopwatch and output the results
               stopwatch.Stop();
               Console.WriteLine($"Sent {numRequests} requests in {stopwatch.ElapsedMilliseconds} ms");
               Console.WriteLine($"Average response time: {stopwatch.ElapsedMilliseconds / (double)numRequests} ms");
               Console.ReadKey();
           }
       }
    }

    Miniprofiler è avviato così :

     builder.Services.AddHttpContextAccessor()
           .AddMiniProfiler(options =>
           {
               options.RouteBasePath = "/profiler";
               options.TrackConnectionOpenClose = true;
               options.ColorScheme = StackExchange.Profiling.ColorScheme.Auto;
               options.EnableMvcFilterProfiling = true;
               options.EnableMvcViewProfiling = true;
               options.ResultsAuthorize = request =>
               {
                   return request.HttpContext.User.IsInRole(Roles.Developer);
               };
           });

    Di una cosa sono certo : il fatto che l'applicazione sia scoppiata durante i test della conversione a .net 6.0 è un fatto puraente occasionale. Secondo me il problema c'era anche prima. Nel mentre ho risolto anche dei leaks legati all'utilizzo di redis.

    Attendo impressioni.
    Grazie,

    S.

  • Re: MiniProfiler Timing memory leaks in applicazione ASP.NET C# MVC

    13/03/2023 - sspagnamn76 ha scritto:


    Ciao colleghi, rispondo ad entrambi.

    Entrambi chi? Ho risposto solo io al momento… :)

    13/03/2023 - sspagnamn76 ha scritto:


    10.000 thread con 500 thread in parallelo […]

    Innanzitutto, stai eseguendo Task e non Thread: il primo è una sorta di “virtualizzazione” del secondo, nata per astrarre il concetto di operazione asincrona, da cui poi il fatto che venga eseguito da un thread si può considerare un corollario.

    Detto questo, stai creando un discreto quantitativo di task simultaneamente, e se ogni task è correlato a una serie di operazioni che richiedono un certo quantitativo di memoria, ivi compresa quella per il task in quanto tale, mi sembra abbastanza naturale che il sistema arrivi a saturarsi.

    Non riesco comunque a farmi uno schema mentale dello scenario che stai testando e di come l'applicazione sia configurata nel sistema in cui esegue, quindi non vedendo dal vivo quello che avviene, mi risulta anche difficile fare ipotesi più particolari sui riscontri che ottieni… sorry.

  • Re: MiniProfiler Timing memory leaks in applicazione ASP.NET C# MVC

    13/03/2023 - Alka ha scritto:


    13/03/2023 - sspagnamn76 ha scritto:


    Ciao colleghi, rispondo ad entrambi.

    Entrambi chi? Ho risposto solo io al momento… :)

    Ni … ieri sera mi sembrava di aver letto una risposta di Migliorabile … che oggi non c'è più.

  • Re: MiniProfiler Timing memory leaks in applicazione ASP.NET C# MVC

    13/03/2023 - max.riservo ha scritto:


    13/03/2023 - Alka ha scritto:


    13/03/2023 - sspagnamn76 ha scritto:


    Ciao colleghi, rispondo ad entrambi.

    Entrambi chi? Ho risposto solo io al momento… :)

    Ni … ieri sera mi sembrava di aver letto una risposta di Migliorabile … che oggi non c'è più.

    Alka ha risposto oltre a te. Hai qualche idea?

    L'eccezione che ricevo quando si “rompe tutto” è questa :

    System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
    ---> System.TimeoutException: A task was canceled.
    ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
      at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
      at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
      at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
      at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
      at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
      at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
      --- End of inner exception stack trace ---
      --- End of inner exception stack trace ---
      at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
      at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
      at Website.BettingApi.Models.BettingUser.AuthenticateAsync(String token) in D:\a\gaming\gaming\Website\BettingApi\Models\User.cs:line 255
      at Website.BettingApi.Models.BettingUser.LoginAsync(String token, Byte languageId) in D:\a\gaming\gaming\Website\BettingApi\Models\User.cs:line 38
      at Website.Controllers.TpAutoLoginController.Index(String otp, String destination, Byte languageId) in D:\a\gaming\gaming\Website\Controllers\TPAutoLoginController.cs:line 41
      at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
      at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
      at Website.Helpers.ScopedPropertiesInitializerMiddleware.InvokeAsync(HttpContext context) in D:\a\gaming\gaming\Website\Helpers\ScopedPropertiesInitializerMiddleware.cs:line 59
      at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
      at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
      at StackExchange.Exceptional.ExceptionalMiddleware.Invoke(HttpContext context)
    Full Trace:
      at StackExchange.Exceptional.ExceptionalMiddleware.Invoke(HttpContext context)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at Website.Helpers.ScopedPropertiesInitializerMiddleware.InvokeAsync(HttpContext context) in D:\a\gaming\gaming\Website\Helpers\ScopedPropertiesInitializerMiddleware.cs:line 58
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at Microsoft.AspNetCore.Mvc.Controller.<OnActionExecutionAsync>g__Awaited|27_0(Controller controller, Task`1 task)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAwaitedAsync>g__Awaited|11_0(ControllerActionInvoker invoker, Task task)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at Website.Controllers.TpAutoLoginController.Index(String otp, String destination, Byte languageId) in D:\a\gaming\gaming\Website\Controllers\TPAutoLoginController.cs:line 29
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at Website.BettingApi.Models.BettingUser.LoginAsync(String token, Byte languageId) in D:\a\gaming\gaming\Website\BettingApi\Models\User.cs:line 36
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at Website.BettingApi.Models.BettingUser.AuthenticateAsync(String token) in D:\a\gaming\gaming\Website\BettingApi\Models\User.cs:line 247
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
      at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
      at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
      at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
      at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
      at System.Threading.ThreadPoolWorkQueue.Dispatch()
      at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
    


    Ciao,
    Simo

  • Re: MiniProfiler Timing memory leaks in applicazione ASP.NET C# MVC

    Ciao,

    il tuo "Stress Test" invia una moltitudine di richieste GET asincrone all'url indicato dalla riga:

    string url = "https://localhost:44332/";

    Dopo circa 25 richieste (asincrone), il server non risponde più e la richiesta successiva si esaurisce per timeout (dopo 100 secondi). E si scaturisce un'eccezione. 

    Tutto assomiglia ad un attacco DOS (Denial Of Service), quindi… se il server si rifiuta di rispondere… mi sembra anche lecito.

Devi accedere o registrarti per scrivere nel forum
6 risposte