Emails getting stuck in Queue

Namita Patil asked on May 4, 2021 02:37

Hi,

We were facing an issue to send emails (emails getting queued up) only after server maintenance is done, here everything comes back to normal except email send functionality. We have noticed that Scheduled task for 'Send Queued emails' have next run time showing in past even if it is configured every minute. Past time is the time when this maintenance was done. Just wanted to check, if we are missing any admin configuration at our side, which needs to be enabled to resolve such issues?

Thanks!

Namita

Recent Answers


Juraj Ondrus answered on May 4, 2021 06:04

What version and hotfix of Kentico are you using and what is exactly the maintenance like? It looks like the thread is being killed which causes incorrect stop of the scheduler or scheduled task. Are other scheduled tasks working fine? Are there any errors in the Event log? When you click the play button to run the task manually, does it work and sets also the correct next run time?

0 votesVote for this answer Mark as a Correct answer

Namita Patil answered on May 4, 2021 08:46

Thanks Juraj for your quick response!

We are using Kentico 12 version and we recently upgraded to hotfix version 12.0.92. This Maintenance is more of patching kind of task.

Along with 'Send Queued emails' scheduled task - "Remove expired sessions" and "Report Subscription Sender" tasks have next run time showing in past too.

When we click the play button to run the task manually, it didn't work, also didn't set correct next run time.

We had to click Restart Application button on Systems page, to resolve this issue.

Also, we got event log with below error:


Unexpected exception occurred while processing activities. Message: Unable to access availability database 'DB_Name' because the database replica is not in the PRIMARY or SECONDARY role. Connections to an availability database is permitted only when the database replica is in the PRIMARY or SECONDARY role. Try the operation again later.

Exception type: System.Data.SqlClient.SqlException Stack trace:

at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout......


We just want to find some other resolution, where we don't have to restart Application explicitly.

Thanks!

Regards, Namita Patil

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on May 4, 2021 08:51

"This Maintenance is more of patching kind of task." - what are the steps, how are you stopping the application, what actions are performed? This sounds to me like the application is killed and not stopped. Also, from the error message I need to ask on how are you connecting to the DB and what is the SQL server like? Are you using replication or mirroring? It looks like that the app after the start cannot connect to the DB correctly. Or, the DBs are somehow misconfigured. This does not sound like a Kentico issue.

0 votesVote for this answer Mark as a Correct answer

Namita Patil answered on May 5, 2021 21:26

This maintenance was all about the upgrade of storage, where storage never went down but was unavailable for some time. Also, we never stop our application for this maintenance task as such, as it never gave this issue before this - but this time storage was not responding, so this issue surfaced.

SQL server wise, it's separate server with mirroring, which we are connecting with general connectionstring.

0 votesVote for this answer Mark as a Correct answer

Namita Patil answered on May 10, 2021 22:50

So, looking at above details I gave - what do you think, do I have some option in Kentico to configure which will avoid this issue happening again? or do you think it's not at all issue from Kentico side?

Namita

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on May 11, 2021 09:57

I would need to know steps and details how to reliable reproduce the issue at will. At this point I can't really tell. My opinion is that there was some DB connection issue (based on the error you posted) and the task ended up in unexpected state because of that.

0 votesVote for this answer Mark as a Correct answer

Namita Patil answered on May 11, 2021 18:08

Thanks for the details, Juraj! I will keep an eye on it, if it happens again I can get more details on it. Thank you so much!

Namita

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.