Threads stuck in Monitor.Wait in ContentFactory.InitField()
See original GitHub issueHi Hakan,
I have another (hopefully) quick question for you.
Occasionally in our production environment (hosted as an Azure App Service), the Thread Count jumps up quite dramatically on one of the instances and it becomes completely unresponsive until I go in and restart it manually.
The application itself gets about 4-10k vistors a day.
I am running 8.0.0 and I have MemoryCache enabled and switched up to Full.
I was able to take a memory dump during one of these episodes and I found that quite a lot of these threads were hung up in Piranha.Services.ContentFactory.InitField(). Here is the Call stack of these threads starting from our controller up to where the thread seems to get locked.
System.Threading.ManualResetEventSlim.Wait(Int32, System.Threading.CancellationToken)+22d
--
System.Threading.Tasks.Task.SpinThenBlockingWait(Int32, System.Threading.CancellationToken)+92
System.Threading.Tasks.Task.InternalWaitCore(Int32, System.Threading.CancellationToken)+f1
System.Threading.Tasks.Task.Wait(Int32, System.Threading.CancellationToken)+35
Piranha.Services.ContentFactory.InitField(Microsoft.Extensions.DependencyInjection.IServiceScope, System.Object)+14e
Piranha.Services.ContentFactory.InitRegion(Microsoft.Extensions.DependencyInjection.IServiceScope, System.Object, Piranha.Models.RegionType)+bb
Piranha.Services.ContentFactory.Init[[System.__Canon, System.Private.CoreLib]](System.__Canon, Piranha.Models.ContentType)+c8
Piranha.Services.PageService+d__18`1[[System.__Canon, System.Private.CoreLib]].MoveNext()+13f
System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Piranha.Services.PageService+d__18`1[[System.__Canon, System.Private.CoreLib]], Piranha]](d__18`1 ByRef)+5e
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib]].Start[[Piranha.Services.PageService+d__18`1[[System.__Canon, System.Private.CoreLib]], Piranha]](d__18`1 ByRef)+2d
Piranha.Services.PageService.GetByIdAsync[[System.__Canon, System.Private.CoreLib]](System.Guid)+66
DigiBook.Controllers.HomeController+d__6.MoveNext()+74
System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[DigiBook.Controllers.HomeController+d__6, DigiBook]](d__6 ByRef)+43
--
DigiBook.Controllers.HomeController.DefaultHomepageAsync(System.Guid, Boolean)+3c
I had a look in the InitField Function and can see the following line is performing a Wait() on the task. Is this something you think could potentially cause Deadlock?
Task.Run(async () => await ((Task)init.Invoke(field, param.ToArray())).ConfigureAwait(false)).Wait();
I have to say, I am in no means an expert on these things and have been learning as much as I can over the last few weeks. I am just trying to get to the bottom of this issue as it’s worrisome that it happens for no reason.
I can provide you with more information if required.
Many Thanks
Adam
Issue Analytics
- State:
- Created 4 years ago
- Comments:27 (12 by maintainers)
Top GitHub Comments
Piranha.Data.EF.SQLServer 8.1.1
should be available on NuGet now.I have merged the code into master and updated project & nuspec versions to
8.1.0-beta4
which is our internal pre-release number. You can build the packages locally by:npm-install
incore/Piranha.Manager
from the command line./pack.sh
in the root directory from the command lineThis will give you all of the packages in an
artifacts
folder in the project root.Please note that there will be some differences you’ll have to make, for example you’ll have to include a database-provider package due to changes in EF Core Migrations >= 3.0. Take a look at the examples in the repository for guidance.
Best regards