On Apr 14, 2011, at 1:13, "Thomas Koch" <k...@orbiteam.de> wrote:

> Hi,
> I've observed some tests failing on my windows build of PyLucene. 
> Tested with PyLucene 2.9(.2) and PyLucene 3.1(.0) (latest) with Python 2.6.
> 
> The problem is with test_PyLucene.py and test_PythonDirectory.py and looks
> like some file lock issue.

Yes, I've been aware of this problem for quite some time. It happens on Windows 
only and I've not tried too hard to fix it hoping that a Windows user might 
elucidate it.

> The test fixture tries to cleanup the created index files (tearDown) which
> fails with windows complaining the file being still in use by some processes
> - see output below (sorry, german windows ,-)
> 
> I tried several things like different windows boxes (Vista/Win7), disabling
> windows processes (antivir, indexer etc.) - with no luck. Finally I came
> across a small change in the test_PyLucene.py code which fixes the issue for
> this test:
> 
> 260c260,261
> <             self.closeStore(store, reader)
> ---
>>            pass
>>            #self.closeStore(store, reader)
> 

Well, sure, not running the code that breaks solves the problem. But can you 
then run the tests multiple times ?

> So this looks like a problem in the test-code rather than in
> windows/python/pyLucene - some store not being closed results in file lock.

Not sure if the bug is there.

Andi..

> 
> However I couldn't fix the issue in test_PythonDirectory.py and still wonder
> if no one else has seen this problem before... 
> Also I wonder why the tests don't fail on other OSes. So I still fear it
> could be somewhat related to either my windows built or windows in
> general...
> 
> Any ideas welcome... (I guess someone had good reason to comment the
> closeStore() ?)
> 
> (sample output of failing tests below - I can report the full failure if
> that's of any help)
> 
> regards,
> 
> Thomas 
> --
> OrbiTeam Software GmbH & Co. KG
> Endenicher Allee 35
> 53121 Bonn Germany
> http://www.orbiteam.de
> 
> 
> sample output:
> --------------
> 
> 
> test>python test_PyLucene.py
> 
> EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
> ======================================================================
> ERROR: test_FieldEnumeration (__main__.Test_PyLuceneWithFSStore)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>  File "test/test_PyLucene.py", line 304, in tearDown
>    shutil.rmtree(path) # self.STORE_DIR)
>  File "C:\Python26\lib\shutil.py", line 221, in rmtree
>    onerror(os.remove, fullname, sys.exc_info())
>  File "C:\Python26\lib\shutil.py", line 219, in rmtree
>    os.remove(fullname)
> WindowsError: [Error 32] Der Prozess kann nicht auf die Datei zugreifen, da
> sie von einem anderen Prozess verwendet wird: 'testrepo\\_0.fdt'
> 
> ==> test succeeds with above fix!
> 
> ======================================================================
> 
> test>python test_PythonDirectory.py
> Testing Indexing Incremental Looping
> ...
> indexing  98
> indexing  99
> .....EEEEEEEE
> ======================================================================
> ERROR: test_removeDocument (__main__.PythonDirectoryTests)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>  File "I:\Devel\test\PyLucene\PYL31\test\test_PyLucene.py", line 178, in 
> test_removeDocument
>    self.closeStore(store, searcher, reader)
>  File "test_PythonDirectory.py", line 241, in closeStore
>    arg.close()
> JavaError: java.lang.RuntimeException: WindowsError
>    Java stacktrace:
> java.lang.RuntimeException: WindowsError
>        at org.apache.pylucene.store.PythonDirectory.deleteFile(Native
> Method)
>        at
> org.apache.lucene.index.IndexFileDeleter.deleteFile(IndexFileDeleter.
> java:542)
>        at
> org.apache.lucene.index.IndexFileDeleter.decRef(IndexFileDeleter.java
> :487)
>        at
> org.apache.lucene.index.IndexFileDeleter.decRef(IndexFileDeleter.java
> :475)
>        at
> org.apache.lucene.index.IndexFileDeleter.close(IndexFileDeleter.java:
> 355)
>        at
> org.apache.lucene.index.DirectoryReader.doCommit(DirectoryReader.java
> :838)
>        at org.apache.lucene.index.IndexReader.commit(IndexReader.java:1191)
>        at org.apache.lucene.index.IndexReader.commit(IndexReader.java:1177)
>        at org.apache.lucene.index.IndexReader.decRef(IndexReader.java:241)
>        at org.apache.lucene.index.IndexReader.close(IndexReader.java:1207)
> 
> 
> ======================================================================
> ERROR: test_removeDocument (__main__.PythonDirectoryTests)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>  File "test_PythonDirectory.py", line 233, in tearDown
>    shutil.rmtree(self.STORE_DIR)
>  File "C:\Devel\Python26\lib\shutil.py", line 217, in rmtree
>    onerror(os.remove, fullname, sys.exc_info())
>  File "C:\Devel\Python26\lib\shutil.py", line 215, in rmtree
>    os.remove(fullname)
> WindowsError: [Error 32] Der Prozess kann nicht auf die Datei zugreifen, da
> sie
> von einem anderen Prozess verwendet wird: 'testpyrepo\\_0.fdt'
> 
> ======================================================================
> 
> 
> 

Reply via email to