Edgewall Software
Modify

Ticket #8278 (closed defect: fixed)

Opened 3 years ago

Last modified 5 months ago

svn_fs.py unit-tests fail with Subversion 1.6.1 on Windows

Reported by: cboos Owned by: cboos
Priority: normal Milestone: 0.11.5
Component: version control Version: none
Severity: normal Keywords: svn16
Cc: james82@…
Release Notes:
API Changes:

Description

There's a new SQLite database in the repository (db/rep-cache.db) which is apparently still opened by the Subversion code at the time we try to rmtree the repository.

I haven't managed to force the removal.
Maybe it's a SVN issue, maybe it's the way we use the API... let's see if the issue persists with 1.6.2.

The first time the tests are executed, we get this error:

WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'c:\\users\\cboos\\appdata\\local\\temp\\trac-svnrepos\\db\\rep-cache.db'

The second time, we get that other error:

svn.core.SubversionException: ("'c:\\users\\cboos\\appdata\\local\\temp\\trac-svnrepos' is a subdirectory of an existing repository rooted at 'c:\\users\\cboos\\appdata\\local\\temp\\trac-svnrepos'", 165002)

(which is somehow normal, as the trac-svnrepos from the previous run is still there)

Attachments

Change History

comment:1 Changed 3 years ago by cboos

  • Cc james82@… added

Added a redirection to this ticket from the code in r8192, in case someone else gets hit by this problem.

... and adding David to the loop in case he has some insight (hope you don't mind ;-) ).

comment:2 Changed 3 years ago by cboos

Same issue with 1.6.2.

comment:3 Changed 3 years ago by cboos

Related: http://svn.haxx.se/dev/archive-2009-05/0061.shtml

We however already cleared the self.repos in the tearDown methods, so it's still not obvious what to do.

comment:4 Changed 3 years ago by cboos

  • Milestone changed from 0.11.6 to 0.11.5
  • Resolution set to fixed
  • Status changed from new to closed

Hm, it was due to our own Pool stuff, fixed in r8209.

By the way, the Subversion python bindings do their own automatic pool management since 1.4.x (or even earlier?), so maybe it's time to simplify things in this area...

Two other things that seem also perfectible:

  • calling core.apr_terminate() in SubversionRepositoryTestSetup.setUp doesn't seem right (An APR program must call this function at termination once it has stopped using APR services. from apr_terminate API)
  • in SubversionRepositoryTestSetup.tearDown, repos.delete(REPOS_PATH) would be simpler (idea stolen from the tests for the Subversion SWIG python bindings...)

comment:5 Changed 3 years ago by cboos

  • Owner set to cboos

comment:6 Changed 3 years ago by cboos

(a follow-up was needed, see r8212 - thanks Remy for noticing the problem)

comment:7 Changed 5 months ago by cboos

With a new install (Python 2.7.2, svn 1.6.15, Windows 7), I have again similar errors, like:

  File "c:\Trac\repos\trunk\trac\versioncontrol\tests\svn_fs.py", line 86, in tearDown
    shutil.rmtree(REPOS_PATH)
  File "C:\Dev\Python272\lib\shutil.py", line 244, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "C:\Dev\Python272\lib\shutil.py", line 244, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "C:\Dev\Python272\lib\shutil.py", line 244, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "C:\Dev\Python272\lib\shutil.py", line 249, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "C:\Dev\Python272\lib\shutil.py", line 247, in rmtree
    os.remove(fullname)
WindowsError: [Error 5] Access is denied: 'c:\\users\\cboos\\appdata\\local\\temp\\trac-svnrepos\\db\\revs\\0\\0'

The following "strengthening" of rmtree in tearDown() fixes it:

  • svn_fs.py

     
    7979        if os.name == 'nt': 
    8080            # The Windows version of 'shutil.rmtree' doesn't override the 
    8181            # permissions of read-only files, so we have to do it ourselves: 
    82             format_file = os.path.join(REPOS_PATH, 'db', 'format') 
    83             if os.path.isfile(format_file): 
    84                 os.chmod(format_file, stat.S_IRWXU) 
    85             os.chmod(os.path.join(REPOS_PATH, 'format'), stat.S_IRWXU) 
    86         shutil.rmtree(REPOS_PATH) 
     82            def retry_remove(fn, path, excinfo): 
     83                if path.startswith(REPOS_PATH): # safety check 
     84                    if os.path.isfile(path): 
     85                        os.chmod(path, stat.S_IRWXU) 
     86                    fn(path) # 2nd try 
     87        shutil.rmtree(REPOS_PATH, onerror=retry_remove) 
    8788 
    8889 
    8990# -- Re-usable test mixins 

But it seems even better to use the svn API for this, hence the final fix in r10794.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.