Issue #3042
closedScheduled tasks break GET calls to /pulp/api/v2/tasks/
Description
Let's say I install the pulp consumer on a host, bind it to an RPM repository, and schedule the installation of a package. If I wait for the task to start and start GETting /pulp/api/v2/tasks/
, I'll get HTTP 500 responses. Looking at the system journal reveals entries like this:
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: Unhandled Exception
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) <TaskStatus: TaskStatus object> is not JSON serializable
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) Traceback (most recent call last):
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) response = wrapped_callback(request, *callback_args, **callback_kwargs)
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) return self.dispatch(request, *args, **kwargs)
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) return handler(request, *args, **kwargs)
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 241, in _auth_decorator
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 195, in _verify_auth
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) value = method(self, *args, **kwargs)
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/tasks.py", line 75, in get
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) return generate_json_response_with_pulp_encoder(serialized_task_statuses)
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/util.py", line 52, in generate_json_response
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) json_obj = json.dumps(content, default=default)
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) File "/usr/lib64/python2.7/json/__init__.py", line 250, in dumps
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) sort_keys=sort_keys, **kw).encode(obj)
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) File "/usr/lib64/python2.7/json/encoder.py", line 207, in encode
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) chunks = self.iterencode(o, _one_shot=True)
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) File "/usr/lib64/python2.7/json/encoder.py", line 270, in iterencode
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) return _iterencode(o, 0)
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/util.py", line 30, in pulp_json_encoder
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) return json_util.default(obj)
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) File "/usr/lib64/python2.7/site-packages/bson/json_util.py", line 257, in default
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) raise TypeError("%%r is not JSON serializable" %% obj)
Sep 26 14:13:35 rhel-7-pulp-2-14 pulp[14923]: pulp.server.webservices.middleware.exception:ERROR: (14923-99776) TypeError: <TaskStatus: TaskStatus object> is not JSON serializable
Beside being an issue in and of itself, this negatively impacts QE's ability to test pulp-consumer. For an example of an affected issue, see Pulp Smash #611.
Updated by amacdona@redhat.com almost 7 years ago
- Triaged changed from No to Yes
Updated by omaciel@redhat.com almost 7 years ago
I'd like to ask for priority on this issue please. As pointed out, it blocks QE.
Updated by ttereshc almost 7 years ago
- Triaged changed from Yes to No
Unset triaged flag to re-evaluate a priority as per previous comment #3042-2
Updated by ttereshc almost 7 years ago
- Triaged changed from No to Yes
@ipanova will try to reproduce it
Updated by ipanova@redhat.com almost 7 years ago
This affects just scheduled action for consumer, scheduled sync or publish does not cause the 500 on /v2/tasks/ get endpoint.
for some reason 2 tasks are created
Operations:
Resources:
State: Successful
Start Time: 2017-10-06T18:33:00Z
Finish Time: 2017-10-06T18:33:00Z
Task Id: c26d4c4d-cb57-4fd6-8360-f6eb991a95fd
Operations: unit_install
Resources: c1 (consumer)
State: Successful
Start Time: 2017-10-06T18:33:00Z
Finish Time: 2017-10-06T18:33:00Z
Task Id: 567fff7a-1306-4cff-9434-c6f7322c1f36
get on the task without any tagks is not serializable
$ pulp-admin tasks details --task-id c26d4c4d-cb57-4fd6-8360-f6eb991a95fd
Warning: path should have mode 0700 because it may contain sensitive information: /home/ipanova/.pulp/
+----------------------------------------------------------------------+
Task Details
+----------------------------------------------------------------------+
An internal error occurred on the Pulp server:
RequestException: GET request on
/pulp/api/v2/tasks/c26d4c4d-cb57-4fd6-8360-f6eb991a95fd/ failed with 500 -
<TaskStatus: TaskStatus object> is not JSON serializable
It is true the get on /v2/tasks/ will give 500 in case that nameless task will be in the list of tasks
though get on /v2/tasks/<task_id> is fine
as well as v2/tasks/search/ which is pulp-admin tasks list --all
Updated by bmbouter over 5 years ago
- Status changed from NEW to CLOSED - WONTFIX