nathanwoulfe/Plumber-2

Upgrade to 1.6.3 has resulted in emails not sending at all.

NikRimington opened this issue · 7 comments

Describe the bug
When an editor tries to send a "Approval Request", they are presented with a double error notification that looks as follows:
image

These are the errors in the Umbraco logs:
image

System.InvalidOperationException: An asynchronous call is already in progress. It must be completed or canceled before you can call this method.
   at System.Net.Mail.SmtpClient.SendAsync(MailMessage message, Object userToken)
   at System.Net.Mail.SmtpClient.SendMailAsync(MailMessage message)
   at Plumber.Core.Notifications.Emailer.SendEmailNotification(IHtmlEmailModel model, EmailType emailType) in D:\a\1\s\Plumber.Core\Notifications\Emailer.cs:line 162
   at Plumber.Core.Notifications.Emailer.SendInBackground(WorkflowInstancePoco instance, EmailType emailType, String errorDetail) in D:\a\1\s\Plumber.Core\Notifications\Emailer.cs:line 102
   at Plumber.Core.Processes.WorkflowProcess.ApproveOrContinue(WorkflowTaskPoco taskInstance, Nullable`1 userId) in D:\a\1\s\Plumber.Core\Processes\WorkflowProcess.cs:line 386
   at Plumber.Core.Processes.WorkflowProcess.InitiateWorkflow(Int32 nodeId, Int32 authorUserId, String authorComment, String scheduledDate, Nullable`1 attachmentId, String variant) in D:\a\1\s\Plumber.Core\Processes\WorkflowProcess.cs:line 115
   at Plumber.Web.Api.ActionsController.InitiateWorkflow(InitiateWorkflowModel model) in D:\a\1\s\Plumber.Web\Api\ActionsController.cs:line 89

Expected behavior
I would expect the approval workflows to trigger.

Desktop (please complete the following information):

  • Azure hosted
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Plumber version
1.6.3 (You're on a nightly build, running Plumber v1.6.3.652)

Licensed version?
Yes

Additional context
This wasn't happening prior to the upgrade to 1.6.3. It wasn't reported happening when the beta was initially deployed but started a couple of days after. I've upgraded to the full release of 1.6.3, but the issue is still happening.

It appears that workflows haven't triggered since the 15th July.

Hey @NikRimington thanks for letting me know. Odd that this didn't start immediately after installing...

I'd consider rolling back to 1.6.2 - while that still has some issues, at least the workflows work.

Wondering if this is somehow relayed to Azure, since it all seems to work fine locally and test all pass etc. I'll have a dig into the 1.6.3 release and see if I can reproduce

Actually, rather than rolling back, would be easier to turn off the notifications. Means no emails, but will prevent this issue

I'll give that a go first thing and see if the workflows start working again.

I've been looking at this just now, have a 1.6.4 build coming soon (will be on NuGet in 30 mins or so). Issue was related to the emails sending async, but the controller returning before that finished (was on the main thread). This was missed in testing because I was sending to a pickup folder so had virtually no latency, so no early return. Was also reusing the same SMTP client, which I think made things a bit slower too.

I've tested with a local SMTP server, emails land with no issue and aren't blocking the UI thread.

I think that it's fixed, it's definitely made the backoffice faster...

Hey Nathan,

I've deployed 1.6.4 and done some testing myself and that looks like it's solved it. I'll let you know if the client still raises issues with it or not :-)

Cheers for your help.

Nik

Awesome, thanks @NikRimington, good to hear. I think I might have crossed some wires when I was merging between this and my netcore branch, nd ended up with the wrong code in some spots.

Hopefully this resolves it ☺️

Emails are now sending (although incorrectly it appears but I've raised a separate issue for that)