I encountered high CPU usage issue in one of the web servers that host Kentico version 9 site. I’ve noticed many Application_Start/STARTAPP from the Kentico’s event log during this incident. I’ve also noticed that there are many Lucene issues listed in the web server’s event viewer > windows logs > application.

FYI Kentico’s smart search is currently using Lucene. Below are the 2 error messages that came from the server’s log:

Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: Lucene.Net.Index.MergePolicy+MergeException
Stack:
at Lucene.Net.Index.ConcurrentMergeScheduler.HandleMergeException(System.Exception)
at Lucene.Net.Index.ConcurrentMergeScheduler+MergeThread.Run()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
An unhandled exception occurred and the process was terminated.
Application ID: DefaultDomain
Process ID: 5372
Exception: System.Runtime.Serialization.SerializationException
Message: Unable to find assembly 'Lucene.Net.v3, Version=3.0.3.0, Culture=neutral, PublicKeyToken=834b12a258f213f9'.
StackTrace: at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)
at System.AppDomain.Deserialize(Byte[] blob)
at System.AppDomain.UnmarshalObject(Byte[] blob)

The second error message was a weird one, because Lucene.Net.v3.dll (with the correct version number) already existed in the bin folder and the project has successfully gone through the build process.

QUICK SOLUTION

After some test and with the help from this post below from Kentico’s forum, I had to rebuild Kentico’s smart search index(es).

http://devnet.kentico.com/questions/lucene-net-index-mergepolicy-mergeexception

More thorough steps below:

  1. Delete all the index files from \App_Data\CMSModules\SmartSearch\ – please note that some of these files may still being used by IIS
  2. Recycle the application pool
  3. Rebuild Kentico’s smart search index
  4. Recycle the application pool again (just to make sure)

As mentioned by Kentico’s support, the worst case scenario is to recreate the indexes from scratch and rebuild the smart search.

Tagged on: