我使用多条线程测试Lucene的搜索.....但经常会弹出"System.ExecutionEngineException"的错误提示,且捕获不到错误的代码...如不用多线程或只一条线程则没事...

解决方案 »

  1.   

    出错的信息描述:
    未处理的“System.ExecutionEngineException”类型的异常出现在 未知模块 中。
      

  2.   

    for(int i=0;i<15;i++)
    {
    threads++;
    new Thread(new ThreadStart(TestAll)).Start();
    //ThreadPool.QueueUserWorkItem(new WaitCallback(TestAll));
    } public void TestAll()
    {

    for(int i=0;i<600;i++)
    {
    TestSearch("翁源",3);
    }

    } public void TestSearch(string target,int count)
    {
    string ss=""; for(int i=0;i<count;i++)
    {
    //int start=Environment.TickCount; //Console.WriteLine(i);
    ss=ic.RunSearch(target,0,"TOP",@"C:\whole-Index");
    threadCount++;
    all++;
    int ticks=Environment.TickCount-st;
    double per=(double)(all/(ticks/1000.0));
    Console.WriteLine("counts : "+threadCount.ToString()+"\t\tThreads : "+threads.ToString()+"\t\t"+i.ToString()+"\t\t"+per.ToString("F2"));

    }
    }
      

  3.   

    执行引擎错误是致命错误,决不应该发生。此类错误主要是在执行引擎被破坏或丢失数据时发生的。系统会随时引发此异常。在可能的情况下,系统将引发比 ExecutionEngineException 异常能提供更多信息的异常。应用程序不应引发 ExecutionEngineException。--MSDN的解释我猜想应该是你的RunSearch函数有问题
    你看看存不存在线程死锁的问题