Project

Profile

Help

Issue #6504

closed

WorkerDirectory.delete() permission fixing causes infinite recursion

Added by ironfroggy over 2 years ago. Updated about 2 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 76
Quarter:

Description

    def delete(self):
        """
        Delete the directory.
        On permission denied - an attempt is made to recursively fix the
        permissions on the tree and the delete is retried.
        """
        try:
            shutil.rmtree(self.path)
        except FileNotFoundError:
            pass
        except PermissionError:
            self._set_permissions()
            self.delete() # <--- RIGHT HERE

WorkerDirectory.delete() attempts to fix permissions and call itself to retry deletion when it fails due to permissions. If this does not fix the problem, it will caues an infinite recursion, raise a RecursionError, and the job will fail.

resource-manager_1  | Traceback (most recent call last):
resource-manager_1  |   File "/venv/bin/rq", line 8, in <module>
resource-manager_1  |     sys.exit(main())
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/click/core.py", line 829, in __call__
resource-manager_1  |     return self.main(*args, **kwargs)
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/click/core.py", line 782, in main
resource-manager_1  |     rv = self.invoke(ctx)
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/click/core.py", line 1259, in invoke
resource-manager_1  |     return _process_result(sub_ctx.command.invoke(sub_ctx))
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/click/core.py", line 1066, in invoke
resource-manager_1  |     return ctx.invoke(self.callback, **ctx.params)
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/click/core.py", line 610, in invoke
resource-manager_1  |     return callback(*args, **kwargs)
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/rq/cli/cli.py", line 78, in wrapper
resource-manager_1  |     return ctx.invoke(func, cli_config, *args[1:], **kwargs)
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/click/core.py", line 610, in invoke
resource-manager_1  |     return callback(*args, **kwargs)
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/rq/cli/cli.py", line 259, in worker
resource-manager_1  |     max_jobs=max_jobs, with_scheduler=with_scheduler)
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/rq/worker.py", line 474, in work
resource-manager_1  |     self.register_birth()
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/pulpcore/tasking/worker.py", line 158, in register_birth
resource-manager_1  |     working_dir.delete()
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/pulpcore/tasking/services/storage.py", line 83, in delete
resource-manager_1  |     self.delete()
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/pulpcore/tasking/services/storage.py", line 83, in delete
resource-manager_1  |     self.delete()
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/pulpcore/tasking/services/storage.py", line 83, in delete
resource-manager_1  |     self.delete()
resource-manager_1  |   [Previous line repeated 972 more times]
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/pulpcore/tasking/services/storage.py", line 82, in delete
resource-manager_1  |     self._set_permissions()
resource-manager_1  |   File "/venv/lib64/python3.6/site-packages/pulpcore/tasking/services/storage.py", line 89, in _set_permissions
resource-manager_1  |     for path in os.walk(self.path):
resource-manager_1  | RecursionError: maximum recursion depth exceeded
Actions #1

Updated by fao89 over 2 years ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 70
Actions #2

Updated by rchan over 2 years ago

  • Sprint changed from Sprint 70 to Sprint 71
Actions #3

Updated by rchan over 2 years ago

  • Sprint changed from Sprint 71 to Sprint 72
Actions #4

Updated by rchan over 2 years ago

  • Sprint changed from Sprint 72 to Sprint 73
Actions #5

Updated by rchan over 2 years ago

  • Sprint changed from Sprint 73 to Sprint 74
Actions #6

Updated by rchan over 2 years ago

  • Sprint changed from Sprint 74 to Sprint 75
Actions #7

Updated by rchan over 2 years ago

  • Sprint changed from Sprint 75 to Sprint 76
Actions #8

Updated by pulpbot about 2 years ago

  • Status changed from NEW to POST

Added by gerrod about 2 years ago

Revision 39954c1d

Fixed WorkerDirectory.delete() causing infinite recursion when permission errors occur

WorkerDirectory.delete() now only trys one additional time to delete its directory tree after encountering a PermissionError

fixes #6504 https://pulp.plan.io/issues/6504

Actions #9

Updated by gerrod about 2 years ago

  • Status changed from POST to MODIFIED

Added by gerrod about 2 years ago

Revision 9047be17

Fixed WorkerDirectory.delete() causing infinite recursion when permission errors occur

WorkerDirectory.delete() now only trys one additional time to delete its directory tree after encountering a PermissionError

fixes #6504 https://pulp.plan.io/issues/6504

(cherry picked from commit 39954c1d70c6fb421528976cb5b125d7850b1eac)

Actions #11

Updated by dkliban@redhat.com about 2 years ago

  • Sprint/Milestone set to 3.6.0
Actions #12

Updated by pulpbot about 2 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF