Hi,
We have a Windows Server 2016 machine in Azure running SQL Server 2016. The server sends around 80 emails a day using DatabaseMail. These are all basically text or HTML emails with no attachments. They are very small emails.
Three days ago we started getting error events in event log related to DatabaseMail. Below are the four events that get raised in order.
Error Event 1:
Database Engine Instance=xxxxxxx;Mail PID=2744;Error Message:
1) Exception Information
===================
Exception Type: System.OutOfMemoryException
Message: Array dimensions exceeded supported range.
Data: System.Collections.ListDictionaryInternal
TargetSite: Boolean TryReadPlpUnicodeChars(Char[] ByRef, Int32, Int32, System.Data.SqlClient.TdsParserStateObject, Int32 ByRef)
HelpLink: NULL
Source: System.Data
HResult: -2147024882
StackTrace Information
===================
at System.Data.SqlClient.TdsParser.TryReadPlpUnicodeChars(Char[]& buff, Int32 offst, Int32 len, TdsParserStateObject stateObj, Int32& totalCharsRead)
at System.Data.SqlClient.TdsParser.TryReadSqlStringValue(SqlBuffer value, Byte type, Int32 length, Encoding encoding, Boolean isPlp, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.TryReadSqlValue(SqlBuffer value, SqlMetaDataPriv md, Int32 length, TdsParserStateObject stateObj, SqlCommandColumnEncryptionSetting columnEncryptionOverride, String columnName)
at System.Data.SqlClient.SqlDataReader.TryReadColumnInternal(Int32 i, Boolean readHeaderOnly)
at System.Data.SqlClient.SqlDataReader.TryReadColumn(Int32 i, Boolean setTimeout, Boolean allowPartiallyReadColumn)
at System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i)
at System.Data.SqlClient.SqlDataReader.GetValue(Int32 i)
at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.DataAccessAdapter.GetSendMailItem(SqlDataReader itemReader)
at Microsoft.SqlServer.Management.SqlIMail.Server.Controller.CommandFactory.CreateSendMailCommand(DBSession dbSession)
at Microsoft.SqlServer.Management.SqlIMail.Server.Controller.CommandRunner.Run(DBSession db)
at Microsoft.SqlServer.Management.SqlIMail.IMailProcess.ThreadCallBack.MailOperation(Object obj)
Error Event 2:
Database Engine Instance=xxxxxx;Mail PID=2744;Error Message:The connection is not open.
Error Event 3:
Database Engine Instance=xxxx;Mail PID=2744;Error Message:
1) Exception Information
===================
Exception Type: Microsoft.SqlServer.Management.SqlIMail.Server.Common.BaseException
Message: The connection is not open.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void ValidateConnection()
HelpLink: NULL
Source: DatabaseMailEngine
HResult: -2146232832
StackTrace Information
===================
at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.ConnectionManager.ValidateConnection()
at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.ConnectionManager.ValidateConnectionAndTransaction()
at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.ConnectionManager.CommitTransaction()
at Microsoft.SqlServer.Management.SqlIMail.IMailProcess.ThreadCallBack.MailOperation(Object obj)
Error Event 4:
Database Engine Instance=xxxxx;Mail PID=2744;Error Message:The connection is not open.
---------------------------------------------------------------
This problem started about 3 days ago. Little has changed on this server. We can still send emails, it's just creating these events. However yesterday and the day before the databasemail service stopped and i had to restart it manually. I have also never
seen this happen in all my years. I have two other similar servers without this issue.
I set up a loop that sent an email every 15 minutes yesterday and tested whether the service had automatically stopped and since i have done this the mail service has continued to run even though it's generating these errors. The fact that the service stopped
two days in a row is what lead me to find these events.
I have noticed that the events are raised when the DatabaseMail server cycles i.e. "DatabaseMail process is started" step occurs at the same time that the error are being geneated.
I have no idea what is going on here. I have read everything i can find, i have restarted the server, their is plenty of memory, no big emails are trying to be sent.
My next step is to turn off the looping email and see if the service stops again. I am looking for assistance on what i can check next.
Regards.
Simon.