"Permission denied" errors removing test directories on Windows.

John Arbash Meinel john at arbash-meinel.com
Thu Jun 26 15:06:28 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark Hammond wrote:
| When running the tests on Windows, its not uncommon to see the message:
|
| | Permission denied: unable to remove testing dir tmpa-x-xxxx
|
| and many test directories get left behind.  We all know files that are
| in-use can't be removed on Windows - broadly, I see 3 reasons why this
will
| be true:
|
| * due to exceptions/stack/etc, a "real" Python reference still exists
to the
| file object.
| * Cyclic garbage still refers to an open file.
| * Some other process has the file open.  Eg, its conceivable a virus
scanner
| or text indexer is running.

We try to be pretty careful in code to use try/finally whenever opening
a file. Guessing, I would say these faults tend to be from the test
suite itself. So knowing what specific tests are failing could help
avoid the problems.

|
| I performed some experiments to try and narrow down the last 2 on my
| machine.  In summary:
|
| * The unmodified test suite fails to remove 46 directories
| * Adding a 'gc.collect()' directly before the osutils.rmtree in
| _rmtree_temp_dir in bzrlib/tests/__init__ reduces this number to 35
| * Addng code that has a short 'sleep-then-retry' loop has no effect (ie,
| everytime the retry loop was entered it still failed to remove the
| directory)
|
| So - while this information doesn't help us get even 1/2 way to actually
| solving the problem, I thought the info may be of interest and probably
| worth adding to the test suite as it is *some* improvement.
|
| Also, while this problem remains, it may make sense for the bzr test suite
| on Windows to create its own sub-directory under %TEMP% which is the
parent
| of all other temp directories.  Any thoughts on that?
|
| Cheers,
|
| Mark

At least at one point we did this. Has that gone away? I would be happy
to have it brought back. (I think the biggest difficulty is just working
out how long that directory needs to exist, and when it can be removed.)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhjol4ACgkQJdeBCYSNAAOgNACglf2A7XbSSTUt7iJK/UvRHoLf
MuIAn3PfRwcmO/pMOm38lMTBvsIH5+JH
=8Z8p
-----END PGP SIGNATURE-----



More information about the bazaar mailing list