Skip to content
April 23, 2011 / kiranpatils

Exception in alarm clock event subscriber [Sitecore 6.3]

Challenge:

On our CD Servers, we started receiving so many Caching issues and to check the issue when we checked log files [Which has become huge in size], we got following errors on all CD servers:

1612 09:18:33 ERROR Exception in alarm clock event subscriber.

Exception: System.Runtime.Serialization.SerializationException

Message: There was an error deserializing the object of type Sitecore.Data.Eventing.Remote.SavedItemRemoteEvent. The token ‘”‘ was expected but found ‘Ï’.

Source: System.Runtime.Serialization

   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)

   at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader)

   at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(Stream stream)

   at Sitecore.Common.Serializer.Deserialize(String data, Type resultType)

   at Sitecore.Eventing.EventQueue.ProcessEvents(Action`2 handler)

   at Sitecore.Eventing.EventProvider.RaiseQueuedEvents()

   at Sitecore.Data.Eventing.EventQueueMonitor.AlarmClock_Ring(Object sender, EventArgs e)

   at Sitecore.Services.AlarmClock.Heartbeat_Beat(Object sender, EventArgs e)

Nested Exception

Exception: System.Xml.XmlException

Message: The token ‘”‘ was expected but found ‘Ï’.

Source: System.Runtime.Serialization

   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)

   at System.Xml.XmlExceptionHelper.ThrowTokenExpected(XmlDictionaryReader reader, String expected, Char found)

   at System.Runtime.Serialization.Json.XmlJsonReader.SkipExpectedByteInBufferReader(Byte characterToSkip)

   at System.Runtime.Serialization.Json.XmlJsonReader.ReadQuotedText(Boolean moveToText)

   at System.Runtime.Serialization.Json.XmlJsonReader.Read()

   at System.Xml.XmlDictionaryReader.ReadContentAsString(Int32 maxStringContentLength)

   at System.Xml.XmlBaseReader.ReadContentAsString()

   at System.Xml.XmlBaseReader.ReadElementContentAsString()

   at System.Runtime.Serialization.XmlReaderDelegator.ReadElementContentAsString()

   at ReadSavedItemRemoteEvent.FieldChangeFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString[] )

   at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)

   at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)

   at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)

   at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns)

   at ReadArrayOfSavedItemRemoteEvent.FieldChangeFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )

   at System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)

   at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)

   at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)

  at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)

   at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns)

   at ReadSavedItemRemoteEventFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString[] )

   at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)

   at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)

   at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)

   at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)

   at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)

   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)

By looking at the error we found that this error is something related to EventQueue — Obviously we are using Sitecore 6.3.

First, we searched this error on Google [as usual] and found this article —  http://sitecoreblog.alexshyba.com/2010/09/common-errors-exception-in-alarm-clock.html and after reading this article we came to know that this issue is in Sitecore 6.0/6.1 – So, if you are using any one of this version better to try as suggested in given article. Or if you are using Sitecore 6.3 [same as us] then keep reading 🙂

Solution:

After digging a lot and with help of Sitecore Support guys we cracked the issue and finally had a good day. So, here are our findings:

What’s the root cause of this issue?

This is BUG in Microsoft’s JSON Serializer, which Sitecore uses under EventQueue for Deserializing data. Then you must be thinking why it doesn’t comes for each site which has Unicode Characters? It won’t come for all. It comes in following case only:

if the data contained more than 648 non-ANSI characters, then only this issue will come up. As shown in below example:

This content helped us to reproduce this issue on another machine.

This is what Sitecore says:

If an error occurred when deserializing remote event data, Sitecore would not process the remaining remote events in the event queue. This could happen if the remote event data contained a large amount of non-ANSI characters. (338130)

The Sitecore.Common.Serializer.Deserialize(string, Type) method would fail with an exception if the data contained more than 648 non-ANSI characters. This was caused by a defect in the Microsoft JSON reader. As a workaround for this defect, the Deserialize method has been changed to use a buffer instead of a stream when passing data to the JSON reader. (338130)

Worth to read : http://sdn.sitecore.net/SDN5/Products/Sitecore%20V5/Sitecore%20CMS%206/ReleaseNotes/ChangeLog/Release%20History%20SC63.aspx

How to resolve it (Temporary fix)?

Due to above error EventQueue – which clears cache and do all publishing related stuffs will not process all the items along with item which has an issue.

Check which Item got published? (You can check CM Server log files).

Connect to your Live Database server(s), check for the Unicode characters in “InstanceData” column, and Delete all found rows. Obviously If you do this automatic cache clear will not work and you need to do manual cache clear.

What’s the permanent fix?

To resolve this issue permanently you need to upgrade CMS 6.3.1 rev.110112. [Click here to read in detail]

Webliography

http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/938156c7-ccb5-4436-833d-d560b9901750

Happy Alarm Clock Ringing! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: