[issue35144] TemporaryDirectory clean-up fails with unsearchable directories

Vidar Fauske report at bugs.python.org
Tue Sep 22 06:41:45 EDT 2020


Vidar Fauske <vidartf at gmail.com> added the comment:

On Python 3.8.5 on Windows using the code from the above patch I recently got a stack overflow:

Thread 0x00002054 (most recent call first):
  File "...\lib\concurrent\futures\thread.py", line 78 in _worker
  File "...\lib\threading.py", line 870 in run
  File "...\lib\threading.py", line 932 in _bootstrap_inner
  File "...\lib\threading.py", line 890 in _bootstrap

Thread 0x00000de4 (most recent call first):
  File "...\lib\concurrent\futures\thread.py", line 78 in _worker
  File "...\lib\threading.py", line 870 in run
  File "...\lib\threading.py", line 932 in _bootstrap_inner
  File "...\lib\threading.py", line 890 in _bootstrap

Current thread 0x00004700 (most recent call first):
  File "...\lib\tempfile.py", line 803 in onerror
  File "...\lib\shutil.py", line 619 in _rmtree_unsafe
  File "...\lib\shutil.py", line 737 in rmtree
  File "...\lib\tempfile.py", line 814 in _rmtree
  File "...\lib\tempfile.py", line 806 in onerror
  File "...\lib\shutil.py", line 619 in _rmtree_unsafe
  File "...\lib\shutil.py", line 737 in rmtree
  ... repeating

-------------------------------------------


In my case, the outer `exc_info` from rmtree is:

PermissionError(13, 'The process cannot access the file because it is being used by another process')


And the inner exception from `_os.unlink(path)` is:

PermissionError(13, 'Access is denied')



I would say that expected behavior in this case would be to let the 'file is in use' error raise, instead of killing the process with an SO.

----------
nosy: +vidartf

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35144>
_______________________________________


More information about the Python-bugs-list mailing list