CMO 2 save statistics error



Has any one seen this or aware of why this could happen ?

EPiServer.Cmo.Core.Statistics.StatisticsHandler.SaveStatistics - Unable to save statistics to database.
System.Data.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: String or binary data would be truncated.
The statement has been terminated.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   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)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   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.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator, EntityConnection connection, Dictionary`2 identifierValues, List`1 generatedValues)
   at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
   --- End of inner exception stack trace ---
   at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
   at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
   at EPiServer.Cmo.Core.Entities.CmoEntities.SaveChangesSkipSecurity()
   at EPiServer.Cmo.Core.Statistics.StatisticsHandler.SaveStatistics(RequestStatisticsData data)

Cheers, Muhammad

Apr 09, 2013 17:15

Hi, Muhammad

Can you reproduce this issue? Is there any certain steps to reproduce?

Let's enable debug logging for CMO statistics handler and see what kind of data it gets and tries to save. Add logger as described below in EPiServerLog.config.

<?xml version="1.0" encoding="utf-8"?>
    <appender name="outputDebugStringAppender" type="log4net.Appender.OutputDebugStringAppender" >
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="[%thread] %level %logger: %message%n" />

    <logger name="EPiServer.Cmo.Core.Statistics.StatisticsHandler" additivity="false">
      <level value="Debug" />
      <appender-ref ref="outputDebugStringAppender" />


You can use your favorite appender instead of DebugView and write logs to file, for example.

Try to reproduce the problem and find the lines in the log where statistics is processed. Search for text like "Process request with statistics data" and see details.

Apr 09, 2013 18:36

Hi Dmytro

I am not able to replicate this on dev/staging - will now enable the additional logging on live where currently compaigns / LM are disabled due to that error.

Our live is load-balanced (2 web fronts) where statistics are disabled on backend server - it looks like either a envionment related problem or may be something to do with LB.

I will let you know my findings.


Apr 11, 2013 10:22

Hi Dmytro

finally found a time to look at this and it comes up the UserAgent field in the CMO table CMO_CMLogEntry throws data truncation error. Its set to maximum lenght of 255 whereas certain certain agent has more than 255 characters.

Any fix available for this from episerver other than us changing the database manually?



Jul 10, 2013 12:31

I don't think there is any hotfix for this case.

I'll file a bug. Could you specify how to reproduce the issue? What is your user agent?

Jul 22, 2013 10:20

FYI: the bug #104533 is registered for this case.

Aug 20, 2013 10:27
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.