Actions
Issue #8595
closedpulp-python publication faling
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix
Sprint:
Quarter:
Description
Hi,
I'm running pulp in a Kubernetes cluster and sometimes python publications are failing with the error '[Errno 39] Directory not empty' , after some debugging the error leads to https://github.com/pulp/pulpcore/blob/master/pulpcore/tasking/storage.py#L60
pulp-cli:
# pulp python publication create --repository foo --version 4
..................Error: Task /pulp/api/v3/tasks/11b036e7-3799-4806-a29b-9a784b6f4857/ failed: '[Errno 39] Directory not empty: 'wheel''
worker log:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/rq/worker.py", line 1008, in perform_job
rv = job.perform()
File "/usr/local/lib/python3.9/site-packages/rq/job.py", line 706, in perform
self._result = self._execute()
File "/usr/local/lib/python3.9/site-packages/rq/job.py", line 729, in _execute
result = self.func(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/pulp_python/app/tasks/publish.py", line 65, in publish
write_simple_api(publication)
File "/usr/local/lib/python3.9/site-packages/pulpcore/tasking/storage.py", line 98, in __exit__
os.chdir(self._prev_dir)
File "/usr/local/lib/python3.9/site-packages/pulpcore/tasking/storage.py", line 55, in delete
self._delete()
File "/usr/local/lib/python3.9/site-packages/pulpcore/tasking/storage.py", line 65, in _delete
#shutil.rmtree(self.path, ignore_errors=True)
File "/usr/local/lib/python3.9/shutil.py", line 718, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/local/lib/python3.9/shutil.py", line 655, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/local/lib/python3.9/shutil.py", line 659, in _rmtree_safe_fd
onerror(os.rmdir, fullname, sys.exc_info())
File "/usr/local/lib/python3.9/shutil.py", line 657, in _rmtree_safe_fd
os.rmdir(entry.name, dir_fd=topfd)
OSError: [Errno 39] Directory not empty: 'wheel'
One quick fix maybe ignore 'OSError' or pass 'shutil.rmtree(self.path, ignore_errors=True)' ref: https://docs.python.org/3/library/shutil.html#shutil.rmtree
Actions
fix directory not empty error
fix issue with
shutil.rmtree
sometime failing with error[Errno 39]Directory not empty
, added new exception block to cathOSError
and retry the rmtree with 'ignore_errors' set to True https://docs.python.org/3/library/shutil.html#shutil.rmtreecloses #8595
Update CHANGES/8595.bugfix
Co-authored-by: David Davis daviddavis@users.noreply.github.com