Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#354 closed defect (fixed)

Python bindings failing tests on Windows

Reported by: Charlie Hull Owned by: Richard Boulton
Priority: normal Milestone: 1.1.0
Component: Xapian-bindings Version: SVN trunk
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: Microsoft Windows

Description

The following failures happen on both Python 2.4 and 2.5.

Running test: postingsource... FAILED

pythontest2.py:987:<type 'exceptions.WindowsError'>: [Error 32] The process cann ot access the file because it is being used by another process: 'db_test_posting source
flintlock'

985 db.close() 986 del db

-> 987 shutil.rmtree(dbpath)

988 989 def test_postingsource2():

Traceback (most recent call last):

File "C:\work\xapian\xapian-SVN\xapian-core\win32\Release\Python25\testsuite2.

py", line 201, in runtest

test_fn()

File "C:\work\xapian\xapian-SVN\xapian-core\win32\Release\Python25\pythontest2

.py", line 987, in test_postingsource

shutil.rmtree(dbpath)

File "c:\Python25\lib\shutil.py", line 174, in rmtree

onerror(os.remove, fullname, sys.exc_info())

File "c:\Python25\lib\shutil.py", line 172, in rmtree

os.remove(fullname)

Xapian version: 1.1.0 Platform: Windows XP (5.1.2600)

When reporting this problem, please quote all the preceding lines from "pythontest2.py:987" onwards.

Running test: postingsource2... FAILED

pythontest2.py:1013:<type 'exceptions.WindowsError'>: [Error 32] The process can not access the file because it is being used by another process: 'db_test_postin gsource2
flintlock'

1011 db.close() 1012 del db

->1013 shutil.rmtree(dbpath)

1014 1015 def test_value_stats():

Traceback (most recent call last):

File "C:\work\xapian\xapian-SVN\xapian-core\win32\Release\Python25\testsuite2.

py", line 201, in runtest

test_fn()

File "C:\work\xapian\xapian-SVN\xapian-core\win32\Release\Python25\pythontest2

.py", line 1013, in test_postingsource2

shutil.rmtree(dbpath)

File "c:\Python25\lib\shutil.py", line 174, in rmtree

onerror(os.remove, fullname, sys.exc_info())

File "c:\Python25\lib\shutil.py", line 172, in rmtree

os.remove(fullname)

Xapian version: 1.1.0 Platform: Windows XP (5.1.2600)

31 tests passed, 2 tests failed NMAKE : fatal error U1077: 'c:\Python25\python.exe' : return code '0x1' Stop.

Change History (6)

comment:1 by Charlie Hull, 16 years ago

Sorry, looks like I already tried to fix this locally, so the line numbers are wrong. Here's the same error with code from SVN HEAD:

Running test: postingsource... FAILED

pythontest2.py:986:<type 'exceptions.WindowsError'>: [Error 32] The process cann ot access the file because it is being used by another process: 'db_test_posting source
flintlock'

984 985 del db

-> 986 shutil.rmtree(dbpath)

987 988 def test_postingsource2():

Traceback (most recent call last):

File "C:\work\xapian\xapian-SVN\xapian-core\win32\Release\Python25\testsuite2.

py", line 201, in runtest

test_fn()

File "C:\work\xapian\xapian-SVN\xapian-core\win32\Release\Python25\pythontest2

.py", line 986, in test_postingsource

shutil.rmtree(dbpath)

File "c:\Python25\lib\shutil.py", line 174, in rmtree

onerror(os.remove, fullname, sys.exc_info())

File "c:\Python25\lib\shutil.py", line 172, in rmtree

os.remove(fullname)

Xapian version: 1.1.0 Platform: Windows XP (5.1.2600)

When reporting this problem, please quote all the preceding lines from "pythontest2.py:986" onwards.

Running test: postingsource2... FAILED

pythontest2.py:1011:<type 'exceptions.WindowsError'>: [Error 32] The process can not access the file because it is being used by another process: 'db_test_postin gsource2
flintlock'

1009 1010 del db

->1011 shutil.rmtree(dbpath)

1012 1013 def test_value_stats():

Traceback (most recent call last):

File "C:\work\xapian\xapian-SVN\xapian-core\win32\Release\Python25\testsuite2.

py", line 201, in runtest

test_fn()

File "C:\work\xapian\xapian-SVN\xapian-core\win32\Release\Python25\pythontest2

.py", line 1011, in test_postingsource2

shutil.rmtree(dbpath)

File "c:\Python25\lib\shutil.py", line 174, in rmtree

onerror(os.remove, fullname, sys.exc_info())

File "c:\Python25\lib\shutil.py", line 172, in rmtree

os.remove(fullname)

comment:2 by Richard Boulton, 16 years ago

Owner: changed from Olly Betts to Richard Boulton
Status: newassigned

Your initial attempt to fix this (by adding db.close()) should work in theory, but I believe I've found the reason that it doesn't: db.close() causes the main process to close all its files, but the lock subprocess is still holding the "db_test_postingsource2/flintlock" file open.

I've verified that this is what happens under unix anyway (by causing the test to sleep just before the shutil.rmtree() call, and inspecting the open files with "lsof").

The fix should be fairly simple - I'll have a quick go at it.

comment:3 by Richard Boulton, 16 years ago

I believe this will be fixed in trunk in r12274. Please test and confirm.

comment:4 by Charlie Hull, 16 years ago

Tested and confirmed, works now.

comment:5 by Olly Betts, 16 years ago

Resolution: fixed
Status: assignedclosed

comment:6 by Olly Betts, 16 years ago

Backported the fix for the exception case for 1.0.12 as r12329 - close() isn't in 1.0, so this actual bug was never present there, so leaving milestone as 1.1.0.

Note: See TracTickets for help on using tickets.