jerrong / Sitecore-Item-Buckets

Manage Large Repositories of Content in Sitecore
18 stars 19 forks source link

The "Accessing IndexSearchContext after Commit() called" error might be thrown under heavy load #30

Closed ob1dev closed 11 years ago

ob1dev commented 11 years ago

The "Accessing IndexSearchContext after Commit() called" error might be thrown under heavy load with following stack trace: ERROR Exception while getting Product for Part Number[TGA2501-GSG] Exception: System.InvalidOperationException Message: Accessing IndexSearchContext after Commit() called Source: Sitecore.Kernel at Sitecore.Search.IndexSearchContext.Search(PreparedQuery query) at Sitecore.ItemBucket.Kernel.Util.IndexSearcher.RunQuery(Query query, Int32 pageSize, Int32 pageNumber, String sortField, String sortDirection) at Sitecore.ItemBucket.Kernel.Util.IndexSearcher.RunQuery(Query query, Int32 pageSize, Int32 pageNumber) at Sitecore.ItemBucket.Kernel.Util.IndexSearcher.GetItems(DateRangeSearchParam param) at Sitecore.ItemBucket.Kernel.ItemExtensions.Axes.ItemExtensions.Search(Item itm, Int32& hitCount, String relatedIds, String indexName, String text, String templates, String location, String sortDirection, String language, String id, String sortField, String itemName, String startDate, String endDate, Int32 numberOfItemsToReturn, Int32 pageNumber) at TriQuint.Web.Services.SitecoreServices.ProductDetailService.GetProductItem(String partNumber)

The reason of the error is in the Dispose() method of the Sitecore.ItemBucket.Kernel.Util.IndexSearcher class.

This method set static IndexSearcher.Index property to null, when another code try accessing it in not static method of the IndexSearcher class. public virtual void Dispose() { Index = null; }

To fix it you can remove/comment out this line in the Dispose() method.

ob1dev commented 11 years ago

This issue is no longer reproducing on Sitecore CMS 7.0.