Hi,

Access to static idStack field in IndexThread(TestIndexModifier.cs)
is not synchronized. That may be the reason. 

i can not test it , since i am not able to reproduce the error.

DIGY

- idStack.Add(doc.Get("id"));
+ lock (idStack)
+ {
+       idStack.Add(doc.Get("id"));
+ }


- delId = idStack[idStack.Count - 1] as System.String;
- idStack.RemoveAt(idStack.Count - 1);
+ lock (idStack)
+ {
+        delId = idStack[idStack.Count - 1] as System.String;
+      idStack.RemoveAt(idStack.Count - 1);
+ }

-----Original Message-----
From: Granroth, Neal V. [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 18, 2007 7:03 PM
To: [email protected]
Subject: Unit test TestIndexWithThreads fails

Has anyone else encountered problems with unit test
"TestIndexModifier.TestIndexWithThreads" using the current source SVN?

I encounter this exception:

An unhandled exception was detected. Since it was most likely thrown on a
separate thread, it may or may not have been caused by the current test.

System.SystemException: Internal error: 2 deleted 0 documents, term=id:38
   at Lucene.Net.Index.IndexThread.Run() in
F:\Lucene-dev2\Test\Index\TestIndexModifier.cs:line 325
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()


If I change the thead affinity of NUnit before starting the tests, forcing
the tests to be run only a single CPU, this exception does not occur.


-- Neal


Reply via email to