Project

Profile

Help

Backport #9505

closed

Backport 9349 to 2.15: Object of type AptRepository is not JSON serializable

Added by rafzei over 2 years ago. Updated over 2 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Triaged:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

Getting Internal Server Error 500 response when calling API.

Query: http post $BASE_ADDR/pulp/api/v3/publications/deb/apt/ repository="/pulp/api/v3/repositories/deb/apt//" simple="true" --verify false

Response:

HTTP/1.1 500 Internal Server Error
Access-Control-Expose-Headers: Correlation-ID
Connection: keep-alive
Content-Length: 145
Content-Type: text/html
Correlation-ID: b067f38ea4fc42ebaca8ef6a9a283460
Date: Wed, 13 Oct 2021 11:57:42 GMT
Referrer-Policy: same-origin
Server: nginx/1.20.1
Vary: Cookie
X-Content-Type-Options: nosniff
X-Frame-Options: DENY

<!doctype html>
<html lang="en">
<head>
  <title>Server Error (500)</title>
</head>
<body>
  <h1>Server Error (500)</h1><p></p>
</body>
</html>

Before, the Repository, Content and Content binding (using add_content_units) was done via API calls. pulpcore-api.log attached.


Files

pulpcore-api.log (3.6 KB) pulpcore-api.log rafzei, 10/13/2021 02:23 PM

Related issues

Is duplicate of Debian Support - Issue #9349: Fix pulpcore 3.15 deprecationsCLOSED - CURRENTRELEASEActions
Actions #1

Updated by quba42 over 2 years ago

I have not seen any similar bugs before, and I don't have any immediate ideas what this might be.

The following additional information might help:

  • The pulpcore version and pulp_deb version used. (http get $BASE_ADDR/pulp/api/v3/status/)
  • How the repo, the content in the repo, was created/added to the repo. (API calls)

I usually upload packages as follows (in case you want to compare with your method):

1.) Upload example package to pulp:

http --form post :/pulp/api/v3/content/deb/packages/ file@binutils_2.31.1-16_amd64.deb

2.) Add the uploaded package content to a pulp repo:

http post :/pulp/api/v3/repositories/deb/apt/<repo_id>/modify/ add_content_units:="[\"<pulp_hrf>\"]"

Note: You can find the `<pulp_hrf_of_the_package_you_uploaded>` using:

http get :/pulp/api/v3/content/deb/packages/

Alternatively you can find it by running `http get` on the task you spawned in step 1.

3.) Create publication (same thing you did, which caused the error in your case)
Actions #2

Updated by rafzei over 2 years ago

The steps I've performed (API calls) were the same you mentioned. One step missing is Repository creation but this is obvious. Please note, that the SSL connection is not trusted. Below details you asked for:

 "database_connection": {
        "connected": true
    },
    "online_content_apps": [
        {
            "last_heartbeat": "2021-10-13T12:42:46.515583Z",
            "name": "29028@pulp-vm"
        },
        {
            "last_heartbeat": "2021-10-13T12:42:47.343918Z",
            "name": "29020@pulp-vm"
        },
        {
            "last_heartbeat": "2021-10-13T12:42:47.369687Z",
            "name": "29013@pulp-vm"
        },
        {
            "last_heartbeat": "2021-10-13T12:42:47.394507Z",
            "name": "29018@pulp-vm"
        },
        {
            "last_heartbeat": "2021-10-13T12:42:47.429486Z",
            "name": "29012@pulp-vm"
        },
        {
            "last_heartbeat": "2021-10-13T12:42:47.481055Z",
            "name": "29015@pulp-vm"
        },
        {
            "last_heartbeat": "2021-10-13T12:42:47.483577Z",
            "name": "29017@pulp-vm"
        },
        {
            "last_heartbeat": "2021-10-13T12:42:47.501697Z",
            "name": "29016@pulp-vm"
        }
    ],
    "online_workers": [
        {
            "last_heartbeat": "2021-10-13T12:42:45.186694Z",
            "name": "29163@pulp-vm.net",
            "pulp_created": "2021-10-11T12:02:12.201004Z",
            "pulp_href": "/pulp/api/v3/workers/a4f4d76c-103c-499b-a22a-a5c19038f8ac/"
        },
        {
            "last_heartbeat": "2021-10-13T12:42:45.198349Z",
            "name": "29313@pulp-vm.net",
            "pulp_created": "2021-10-11T12:02:17.292276Z",
            "pulp_href": "/pulp/api/v3/workers/43b7a301-f5a0-45dd-81dd-bf2e7b23f6ba/"
        }
    ],
    "redis_connection": {
        "connected": true
    },
    "storage": {
        "free": 27733942272,
        "total": 31146369024,
        "used": 3412426752
    },
    "versions": [
        {
            "component": "core",
            "version": "3.16.0"
        },
        {
            "component": "rpm",
            "version": "3.15.0"
        },
        {
            "component": "file",
            "version": "1.10.0"
        },
        {
            "component": "deb",
            "version": "2.15.0"
        }
    ]
}
Actions #3

Updated by quba42 over 2 years ago

Those are the latest release versions. I will need to see if I can reproduce the same issue. I believe I have all the information I need to do that. With any luck I will get around to it tomorrow.

Actions #4

Updated by rafzei over 2 years ago

Hello, any findings?

quba42 wrote:

Those are the latest release versions. I will need to see if I can reproduce the same issue. I believe I have all the information I need to do that. With any luck I will get around to it tomorrow.

Actions #5

Updated by arogarth over 2 years ago

Same here ...

Follwing the description from https://docs.pulpproject.org/pulp_deb/workflows/publish.html


Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: pulp [e1c61e33871648ad8ed2483afe33ca73]: django.request:ERROR: Internal Server Error: /pulp/api/v3/publications/deb/apt/
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: Traceback (most recent call last):
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/usr/local/lib/pulp/lib64/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: response = get_response(request)
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/usr/local/lib/pulp/lib64/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: response = wrapped_callback(request, *callback_args, **callback_kwargs)
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/usr/local/lib/pulp/lib64/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: return view_func(*args, **kwargs)
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/usr/local/lib/pulp/lib64/python3.8/site-packages/rest_framework/viewsets.py", line 125, in view
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: return self.dispatch(request, *args, **kwargs)
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/usr/local/lib/pulp/lib64/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: response = self.handle_exception(exc)
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/usr/local/lib/pulp/lib64/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: self.raise_uncaught_exception(exc)
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/usr/local/lib/pulp/lib64/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: raise exc
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/usr/local/lib/pulp/lib64/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: response = handler(request, *args, **kwargs)
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/usr/local/lib/pulp/lib64/python3.8/site-packages/pulp_deb/app/viewsets/publication.py", line 88, in create
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: result = dispatch(
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/usr/local/lib/pulp/lib64/python3.8/site-packages/pulpcore/tasking/tasks.py", line 78, in dispatch
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: args_as_json = json.dumps(args, cls=UUIDEncoder)
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/opt/rh/rh-python38/root/usr/lib64/python3.8/json/__init__.py", line 234, in dumps
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: return cls(
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/opt/rh/rh-python38/root/usr/lib64/python3.8/json/encoder.py", line 199, in encode
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: chunks = self.iterencode(o, _one_shot=True)
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/opt/rh/rh-python38/root/usr/lib64/python3.8/json/encoder.py", line 257, in iterencode
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: return _iterencode(o, 0)
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/usr/local/lib/pulp/lib64/python3.8/site-packages/pulpcore/tasking/tasks.py", line 24, in default
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: return super().default(obj)
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: File "/opt/rh/rh-python38/root/usr/lib64/python3.8/json/encoder.py", line 179, in default
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: raise TypeError(f'Object of type {o.__class__.__name__} '
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: TypeError: Object of type AptRepository is not JSON serializable
Oct 19 11:08:20 cf1-pulp01.vagrant.infra.de.local.net gunicorn: pulp [e1c61e33871648ad8ed2483afe33ca73]: 127.0.0.1 - admin [19/Oct/2021:09:08:20 +0000] "POST /pulp/api/v3/publications/deb/apt/ HTTP/1.0" 500 145 "-" "HTTPie/1.0.3"
Actions #7

Updated by quba42 over 2 years ago

If it is fixed on the main branch, I should just go ahead and perform a release. There are only two real changes between the last release and main, but one of them fixes some pulpcore deprecations. Maybe those deprecations were removed sooner than I anticipated. Not sure when I will find the time, to test this, and then perform a release...

Actions #8

Updated by arogarth over 2 years ago

Update - Same happens to pulp_deb/app/viewsets/repository.py - on sync to remote repo...

Actions #9

Updated by quba42 over 2 years ago

I was able to reproduce this issue on the 2.15 branch, but failed to do so on the main branch, so something must have fixed it already... I will do one more test to see if I can find the exact commit that fixes it.

Actions #10

Updated by quba42 over 2 years ago

  • Is duplicate of Issue #9349: Fix pulpcore 3.15 deprecations added
Actions #11

Updated by quba42 over 2 years ago

Looks like I just messed up the deprecation policy, and failed to add the deprecation fixes to the pulp_deb 2.15 release... Ups...

Actions #12

Updated by quba42 over 2 years ago

  • Tracker changed from Issue to Backport
  • Subject changed from Err500 when trying to create Publication via API call to Backport 9349 to 2.15
  • % Done set to 0
  • Severity deleted (2. Medium)
  • OS deleted (CentOS 7)
  • Groomed deleted (No)
Actions #13

Updated by quba42 over 2 years ago

  • Subject changed from Backport 9349 to 2.15 to Backport 9349 to 2.15: Object of type AptRepository is not JSON serializable
Actions #14

Updated by pulpbot over 2 years ago

  • Status changed from NEW to POST

Added by quba42 over 2 years ago

Revision ac420e33 | View on GitHub

Fix pulpcore deprecations

backports #9349 https://pulp.plan.io/issues/9349

fixes #9505

(cherry picked from commit 18722b70c1b9f160b473167ec61de6aab1355dff)

Actions #15

Updated by quba42 over 2 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100
Actions #16

Updated by pulpbot over 2 years ago

  • Sprint/Milestone set to 2.15.1
Actions #17

Updated by pulpbot over 2 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF