This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients jkloth, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2017-05-10.15:50:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1494431411.13.0.126195064019.issue30334@psf.upfronthosting.co.za>
In-reply-to
Content
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...
History
Date User Action Args
2017-05-10 15:50:11vstinnersetrecipients: + vstinner, paul.moore, tim.golden, jkloth, zach.ware, steve.dower
2017-05-10 15:50:11vstinnersetmessageid: <1494431411.13.0.126195064019.issue30334@psf.upfronthosting.co.za>
2017-05-10 15:50:11vstinnerlinkissue30334 messages
2017-05-10 15:50:10vstinnercreate