Dianoga
Dianoga copied to clipboard
Dianoga causes thread pool threads to wait
Version of Dianoga
6.1.0
Environment description
Sitecore XM 10.2.1 (rev. 009392 PRE)
What configs you have enabled
Default
Reproducible steps (1... 2... 3...) that cause the issue
We noticed that the CPU would hit 100% sometimes and cause app pool restarts. So we collected a dump of the w3wp process when this scenario occurred and analysed it in Visual Studio 2022.
This analysis showed us a warning:
Analysis summary
1 thread pool threads are waiting on a synchronous call to 'System.Threading.WaitHandle.WaitOne(int, bool)' from method
'Dianoga.Optimizers.CommandLineToolOptimizer.ExecuteProcess(string).
Potential fix
Do not synchronously wait on Monitors, Events, Tasks, or any other objects that may block your thread. See if you can update the method to be asynchronous by, for example, using asynchronous file or database access. Frameworks such as ASP.NET MVC now support asynchronous controllers for operations that may take a long time.