Sitecore中的Lucene索引已损坏(ArgumentOutOfRangeException) [英] Lucene Indexes in Sitecore getting corrupted (ArgumentOutOfRangeException)

查看:108
本文介绍了Sitecore中的Lucene索引已损坏(ArgumentOutOfRangeException)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Sitecore中搜索Lucene索引时遇到问题.一切工作了一会儿,然后,在经过一段随机的时间之后,我们在针对索引的每次搜索中都开始出现以下错误:

We are having an issue with searching a Lucene Index in Sitecore. Everything works fine for a while, and then, after what appears to be a random amount of time, we start getting the following error on every single search against the index:

System.ArgumentOutOfRangeException 
Message: Non-negative number required. 
Parameter name: capacity Source: mscorlib 
  at System.Collections.Hashtable..ctor(Int32 capacity, Single loadFactor)
  at System.Collections.Hashtable.Clone() 
  at SupportClass.WeakHashTable.Clean() 
  at SupportClass.WeakHashTable.CleanIfNeeded() 
  at SupportClass.WeakHashTable.Add(Object key, Object value) 
  at Lucene.Net.Util.CloseableThreadLocal.Set(Object object) 
  at Lucene.Net.Index.TermInfosReader.GetThreadResources() 
  at Lucene.Net.Index.TermInfosReader.Get(Term term, Boolean useCache) 
  at Lucene.Net.Index.SegmentReader.DocFreq(Term t) 
  at Lucene.Net.Index.DirectoryReader.DocFreq(Term t) 
  at Lucene.Net.Search.Similarity.IdfExplain(Term term, Searcher searcher)
  at Lucene.Net.Search.TermQuery.CreateWeight(Searcher searcher) 
  at Lucene.Net.Search.BooleanQuery.BooleanWeight..ctor(BooleanQuery enclosingInstance, Searcher searcher) 
  at Lucene.Net.Search.BooleanQuery.CreateWeight(Searcher searcher) 
  at Lucene.Net.Search.Query.Weight(Searcher searcher) 
  at Lucene.Net.Search.Hits..ctor(Searcher s, Query q, Filter f, Sort o) 
  at Lucene.Net.Search.Searcher.Search(Query query, Sort sort) 
  at scSearchContrib.Searcher.QueryRunner.RunQuery(Query query, Boolean showAllVersions, String sortField, Boolean reverse, Int32 start, Int32 end) 
  at scSearchContrib.Searcher.QueryRunner.GetItems(IEnumerable`1 parameters, Boolean showAllVersions, String sortField, Boolean reverse, Int32 start, Int32 end) at

看看(通过ILSpy)被调用的.Net代码和Lucene.Net代码,我看不到这将如何发生.在哈希表上调用.Clone()不应允许将负数传递给哈希表容量.

Looking at the .Net code and Lucene.Net code being called (via ILSpy), I can't see how this would actually happen. Calling .Clone() on a hashtable shouldn't allow a negative number for the hashtable capacity to be passed in.

在服务器场中的多台服务器上已发生过多次,重新启动IIS可解决此问题.这使我相信内存中正在发生某种腐败,但是我不确定是什么原因导致这种情况或如何确定发生了什么.

This has happened several times, on multiple servers in our farm, and restarting IIS resolves the issue. This leads me to believe that there is some sort of in-memory corruption happening, but I'm not sure what would cause this or how to figure out what is going on.

推荐答案

Sitecore支持针对Sitecore 6.6提供了一种解决方法. Lucene.NET 2.9.4中使用的WeakHashTable类显然存在一些令人讨厌的线程安全问题.此问题在更高版本的Lucene.NET中以及通过Sitecore 7中的相应升级得到解决.

Sitecore support has a workaround for this for Sitecore 6.6. There are apparently some nasty thread-safety issues with the WeakHashTable class used in Lucene.NET 2.9.4. This issue is addressed in later versions of Lucene.NET and via the corresponding upgrades in Sitecore 7.

这篇关于Sitecore中的Lucene索引已损坏(ArgumentOutOfRangeException)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆