Nop 2.60 - Emails stay on the queue

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
I need your help and opinion about my emails that stays on the Message Queue for ever.


(Although the test mail functionality works fine though)

The email that the customers sent through the contact form of my 2.60 Nopcommerce is never delivered
and it stays on the Message Queue for ever.

Below are messages from the log and the detailed exception:
(it seems that it is a sql related issue)


In the Log:
Error while running the 'Send emails' schedule task. An error occurred while executing the command definition.
See the inner exception for details.

System.Data.EntityCommandExecutionException: An error occurred while executing the command definition.
See the inner exception for details. ---> System.Data.SqlClient.SqlException: Timeout expired.
The timeout period elapsed prior to completion of the operation or the server is not responding.
---> System.ComponentModel.Win32Exception: The wait operation timed out --- End of inner exception stack trace ---
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection,
Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,
Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj,
Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream,
Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior,
Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream,
String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand,
CommandBehavior behavior) --- End of inner exception stack trace ---
at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand,
CommandBehavior behavior) at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context,
ObjectParameterCollection parameterValues)
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Data.Entity.Internal.Linq.InternalQuery`1.GetEnumerator()
at System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Nop.Core.PagedList`1..ctor(IQueryable`1 source,
Int32 pageIndex, Int32 pageSize) at Nop.Services.Messages.QueuedEmailService.SearchEmails(String fromEmail, String toEmail,
Nullable`1 startTime, Nullable`1 endTime, Boolean loadNotSentItemsOnly, Int32 maxSendTries, Boolean loadNewest, Int32 pageIndex,
Int32 pageSize) at Nop.Services.Messages.QueuedMessagesSendTask.Execute() at Nop.Services.Tasks.Task.Execute()


My server settings are :
Server in shared hosting
nopCommerce version:  2.60
Operating systemOperating system:  Microsoft Windows NT 6.3.9600.0
ASP.NET infoASP.NET info:  v4.0.30319
Is full trust levelIs full trust level:  True


1. Any idea why this is happening and how can I solve it ?
7 years ago
Did it used to work OK?
This is a general Sql Server "Timeout expired" error.  Maybe you have too many old (sent) emails in the table (???).  You can delete them with a tool like SSMS:

DELETE [QueuedEmail] WHERE [SentOnUtc] is not null

(They won't be recoverable, so be sure you want to delete them permanently.  You can adjust the date if you want to keep some)
7 years ago
Thank you for the reply

Indeed the QueuedEmail table has a lot of entries and it used to work fine


1) So you suggest that truncating the table it might work - is that right ?


2) What do you think about the Timeout expired of the Sql Server ? Do you see in error log
any specific reason for that ? (May be it is server side by the hosting provider so I have to contact them)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.