In today’s post I am going to share an issue I faced a while ago during a login process Error: An error occurred after logging in Sitecore
People think IT professionals are fearless but no one knows the nightmare we could have by simple hearing the words Blue Screen of Death (BSoD). And since I started working with Sitecore the Yellow Screen of Death (YSoD) also cause damage!
Needless to say that all errors are scary, especially if they don’t help you with a direction to determine the cause of it.
A few weeks ago, in a Sitecore 9.1 environment, after logging in Sitecore Identity Server, I received the following error message
Error: An error occurred
Definitely not helpful, right?
The logs in Sitecore
20892 10:35:42 ERROR String or binary data would be truncated.
The statement has been terminated.
Exception: System.Exception
Message: String or binary data would be truncated.
The statement has been terminated.
Source: Sitecore.Kernel
at Sitecore.Data.DataProviders.Sql.DataProviderCommand.ExecuteNonQuery()
at Sitecore.Data.DataProviders.Sql.SqlDataApi.<>c__DisplayClass33_0.<Execute>b__0()
at Sitecore.Data.DataProviders.NullRetryer.Execute[T](Func`1 action, Action recover)
at Sitecore.Data.Properties.SqlPropertyStore.SetStringValueCore(String prefixedName, String value)
at Sitecore.Data.Properties.PropertyStore.SetStringValue(String name, String value)
at Sitecore.Web.Authentication.DefaultTicketManager.CreateTicket(String userName, String startUrl, Boolean persist)
at Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.SignedIn.CreateTicket.Process(SignedInArgs args)
at (Object , Object )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Owin.Authentication.Security.Cookies.DefaultCookieAuthenticationProvider.ResponseSignedIn(CookieResponseSignedInContext context)
at Microsoft.Owin.Security.Cookies.CookieAuthenticationHandler.<ApplyResponseGrantAsync>d__f.MoveNext()
— End of stack trace from previous location where exception was thrown —
Nested ExceptionException: System.Data.DataException
Message: Error executing SQL command: INSERT INTO [Properties] ( [Key], [Value] ) VALUES ( @name, @value )Nested Exception
Exception: System.Data.SqlClient.SqlException
Message: String or binary data would be truncated.
The statement has been terminated.
Source: .Net SqlClient Data Provider
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
The issue
Sitecore has an agent that automatically clean expired authentication tickets known as Sitecore.Tasks.CleanupAuthenticationTicketsAgent, however, the agent fails to cleam them up, so the expired records remain in the Properties table. Large numbers of “SC_TICKET” records may lead to performance degradation of the login process.
And as we observed, it also cause the useless error to happen Error: An error occurred
The fix
Sitecore has a KB providing a solution for Sitecore 8.2 Update 6 & Update 7, Sitecore 9 Initial Release, Update 1 and Update 2.
Important: only install KBs that match your Sitecore version, if you have questions about it, please contact Sitecore Support
Since Sitecore 9.1 Initial Release was not listed, I have asked for a solution from Sitecore and it was not possible as my installation already has hotfixes for a couple other bugs and will not cover all of them if we want to fix the issue described in this post.
Well, if that’s not your case, please refer to Sitecore Support the following reference #227832
The workaround
For those facing the same and couldn’t get a permanent solution, there is a workaround for the problem
Important: all the editors will be logged out once the query finished processing
USE [your_core_database_name]; DELETE FROM [dbo].[Properties] WHERE [dbo].[Properties].[Key] like '%SC_TICKET%'
And that’s it!
I hope you liked, and I’ll see you on my next post.
Deixe um comentário