Project

Profile

Help

Issue #4289

closed

Story #3693: Lazy for Pulp3

Content delivery breaks if remote is deleted

Added by gmbnomis almost 6 years ago. Updated almost 5 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 48
Quarter:

Description

Problem

It is possible to delete a Remote which is referenced by RemoteArtifacts that are part of a Publication/Repo. As cascading delete is used (https://github.com/pulp/pulp/blob/88a6ebf31de83a4877909fa93fd94bf122894838/pulpcore/app/models/content.py#L335), this will delete the RemoteArtifacts as well.

If such an artifact is retrieved via the content app and needs to be streamed, this will fail with an internal server error:

Dec 30 17:41:45 pulp3.dev gunicorn[23755]: Traceback (most recent call last):
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:   File "/home/vagrant/.virtualenvs/pulp/lib64/python3.6/site-packages/aiohttp/web_protocol.py", line 390, in start
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:     resp = await self._request_handler(request)
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:   File "/home/vagrant/.virtualenvs/pulp/lib64/python3.6/site-packages/aiohttp/web_app.py", line 366, in _handle
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:     resp = await handler(request)
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:   File "/home/vagrant/devel/pulp/pulpcore/content/handler.py", line 65, in stream_content
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:     return await self._match_and_stream(path, request)
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:   File "/home/vagrant/devel/pulp/pulpcore/content/handler.py", line 179, in _match_and_stream
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:     return await self._stream_content_artifact(request, web.StreamResponse(), ca)
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:   File "/home/vagrant/devel/pulp/pulpcore/content/handler.py", line 223, in _stream_content_artifact
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:     remote_artifact = content_artifact.remoteartifact_set.get()
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:   File "/home/vagrant/.virtualenvs/pulp/lib64/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:     return getattr(self.get_queryset(), name)(*args, **kwargs)
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:   File "/home/vagrant/.virtualenvs/pulp/lib64/python3.6/site-packages/django/db/models/query.py", line 399, in get
Dec 30 17:41:45 pulp3.dev gunicorn[23755]:     self.model._meta.object_name
Dec 30 17:41:45 pulp3.dev gunicorn[23755]: pulpcore.app.models.content.RemoteArtifact.DoesNotExist: RemoteArtifact matching query does not exist.

Possible solutions:

1. Block the deletion of the remote as long as referencing RemoteArtifacts exist
2. Return a 404 not found error


Related issues

Copied to Pulp - Test #4464: Content delivery breaks if remote is deletedCLOSED - COMPLETEkersomActions
Actions #1

Updated by jortel@redhat.com almost 6 years ago

The cascading delete is the correct behavior. The streamer just needs to 404 when no matching RemoteArtifact records are found. Probably should log at DEBUG that it could not find any RemoteArtifact for the URL for troubleshooting.

Actions #2

Updated by CodeHeeler almost 6 years ago

  • Tags Pulp 3 RC Blocker added
Actions #3

Updated by CodeHeeler almost 6 years ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 47
Actions #4

Updated by bmbouter almost 6 years ago

I believe cascade deleting the RemoteArtifacts when the Remote is deleted makes sense because there is effectively no Remote to fetch it so all it can do is fail.

It should fail gracefully so +1 to option 2. It should raise an aiohttp.web_exceptions.HttpNotFound exception in the case where the ContentArtifact exists, but has no Artifact and no RemoteArtifact. Is this right?

Actions #5

Updated by rchan almost 6 years ago

  • Sprint changed from Sprint 47 to Sprint 48
Actions #6

Updated by bmbouter almost 6 years ago

  • Parent issue set to #3693
Actions #7

Updated by bmbouter almost 6 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to bmbouter
Actions #8

Updated by bmbouter almost 6 years ago

  • Status changed from ASSIGNED to MODIFIED

This was resolved accidentally by another PR. Specifically this change here: https://github.com/pulp/pulp/pull/3826/files#diff-8d791f887df7f2776bf3a0396432c40bR270

Actions #9

Updated by bherring almost 6 years ago

  • Copied to Test #4464: Content delivery breaks if remote is deleted added
Actions #10

Updated by daviddavis over 5 years ago

  • Sprint/Milestone set to 3.0.0
Actions #11

Updated by bmbouter over 5 years ago

  • Tags deleted (Pulp 3, Pulp 3 RC Blocker)
Actions #12

Updated by bmbouter almost 5 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF