PreMailer.Net icon indicating copy to clipboard operation
PreMailer.Net copied to clipboard

Upgrade from v1.3.4 to v2.7.2 produced deadlocks/stalled when trying to inline CSS

Open stomasovic opened this issue 1 month ago • 2 comments

Upgrading from old version 1.3.4. to newest 2.7.2 blocked our Email template generation on CORP environments. Good thing that we noticed during tests. It was fine in light load, but started to block when creating a lot of templates concurrently. Upgrading to 2.7.2 required to upgrade AngleSharp to version >=1.3.0, and we upgraded to 1.3.0 version from version 0.17.1.

When testing locally via UnitTests it was running fine, even in case of high load and concurrency, but on CORP environments, where JobScheduler is running as AspNet Web.Api2 (net4.8) app, it started to stall. Jobs started to pile up, and could not process. Some were blocked for hours, and could not finish.

While taking memory dumps and checking threads, most of the threads were stalled in some of the AngleSharp code (random, not always the same), rarely in PreMailer code. It was either in PreMailer constructor or call to MoveCssInline.

After we reverted back to 1.3.4. everything is working fine again. Did you have issues like this in past?

Plan is to upgrade to v2.4.0, as that does not require AngleSharp upgrade and will test next week.

Thanks, Srecko

stomasovic avatar Oct 31 '25 20:10 stomasovic

Any chance you have an isolated test you can share that reproduce the problem?

martinnormark avatar Nov 01 '25 10:11 martinnormark

Unfortunately, no isolated tests. It is hard to reproduce, except load our JobScheduling component to generate those emails. As mentioned above, in UnitTests, we load it heavily with a lot of concurrent template conversions, no issues.

Seems that creating those Emails (from cshtml razor templates) in "normal" part of web app is working fine, did not notice blockings, but it could be an issue that it was not heavily loaded.

As noted above, plan is to upgrade to v2.4.0, and leave AngleSharp to 0.17.1, then see what is going on. Will keep you posted after that upgrade in next days.

stomasovic avatar Nov 03 '25 08:11 stomasovic