[New-bugs-announce] [issue30334] [Windows] support.rmtree() should retry on WindowsError: [Error 32] The process cannot access the file because it is being used by another process
STINNER Victor
report at bugs.python.org
Wed May 10 11:50:11 EDT 2017
New submission from STINNER Victor:
test_startfile uses a weak time.sleep(0.1) to wait until the process started by os.startfile() completes. Instead of a sleep, can't support.rmtree() retry on "WindowsError: [Error 32] The process cannot access the file because it is being used by another process" error? For example, retry every 100 ms during 10 seconds?
It's easy to reproduce the bug on Python 2.7: just remove the time.sleep() call in tests.
http://buildbot.python.org/all/builders/x86%20Windows7%202.7/builds/145/steps/test/logs/stdio
0:23:42 [363/402/1] test_startfile crashed
[1, 5.638000011444092]
Traceback (most recent call last):
File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows7\build\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows7\build\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows7\build\lib\test\regrtest.py", line 1877, in <module>
main_in_temp_cwd()
File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows7\build\lib\test\regrtest.py", line 1864, in main_in_temp_cwd
main()
File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows7\build\lib\contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows7\build\lib\test\support\__init__.py", line 769, in temp_cwd
rmtree(name)
File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows7\build\lib\test\support\__init__.py", line 293, in rmtree
_rmtree(path)
File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows7\build\lib\test\support\__init__.py", line 249, in _rmtree
_waitfor(lambda p: _force_run(p, os.rmdir, p), path)
File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows7\build\lib\test\support\__init__.py", line 202, in _waitfor
func(pathname)
File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows7\build\lib\test\support\__init__.py", line 249, in <lambda>
_waitfor(lambda p: _force_run(p, os.rmdir, p), path)
File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows7\build\lib\test\support\__init__.py", line 197, in _force_run
return func(*args)
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'D:\\cygwin\\home\\db3l\\buildarea\\2.7.bolen-windows7\\build\\build\\test_python_2944'
--
If it's too complex to implement a retry (too complex? really?), an obvious hack is to increase the sleep in test_startfile.py from 100 ms to 200 ms...
----------
components: Tests, Windows
messages: 293428
nosy: haypo, jkloth, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: [Windows] support.rmtree() should retry on WindowsError: [Error 32] The process cannot access the file because it is being used by another process
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30334>
_______________________________________
More information about the New-bugs-announce
mailing list