Project

Profile

Help

Issue #1657

Pulp event notifier raising JSON serializer stack traces

Added by paji@redhat.com over 4 years ago. Updated 4 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Master
Platform Release:
2.8.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix, Pulp 2
Sprint:
Quarter:

Description

1) Create a post sync notifier in pulp. There may be a pulp-admin way of doing this -> but Katello does it in the following way

path = /pulp/api/v2/events/, args = post,{"notifier_type_id":"http","notifier_config":{"url":"https://<SAT FQDN>/katello/api/v2/repositories/sync_complete?token=test"},"event_types":["repo.sync.finish"]},{"content_type"=>"application/json", "accept"=>"application/json", "Authorization"=>"OAuth oauth_body_hash=\"2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D\", oauth_consumer_key=\"5N52BJQuADMGfHKMhzRV8NUfKUZvePw4\", oauth_nonce=\"b5L7Mkm0QXEi4WiM2j3Sdqz4CCPsdxnYClgBJ2dxyko\", oauth_signature=\"s%2BhM%2FjS%2FBMaFuu%2FpS%2FezpubMdcs%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1454430929\", oauth_version=\"1.0\"", "pulp-user"=>"admin"}

2) Sync any repo

See this in /var/log/messages

NISHED'}, 'purge_duplicates': {'state': 'FINISHED'}, 'distribution': {'items_total': 0, 'state': 'FINISHED', 'error_details': [], 'items_left': 0}, 'errata': {'state': 'FINISHED'}, 'metadata': {'state': 'FINISHED'}}, 'id': '56bb944fde04030b8405420b', 'removed_count': 0}}
Feb 10 14:49:35 katello-yoda celery: Exception in thread Thread-142:
Feb 10 14:49:35 katello-yoda celery: Traceback (most recent call last):
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib64/python2.7/threading.py", line 811, in __bootstrap_inner
Feb 10 14:49:35 katello-yoda celery: self.run()
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib64/python2.7/threading.py", line 764, in run
Feb 10 14:49:35 katello-yoda celery: self.__target(*self.__args, **self.__kwargs)
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib/python2.7/site-packages/pulp/server/event/http.py", line 56, in _send_post
Feb 10 14:49:35 katello-yoda celery: response = post(url, json=data, auth=auth)
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib/python2.7/site-packages/requests/api.py", line 108, in post
Feb 10 14:49:35 katello-yoda celery: return request('post', url, data=data, json=json, **kwargs)
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib/python2.7/site-packages/requests/api.py", line 50, in request
Feb 10 14:49:35 katello-yoda celery: response = session.request(method=method, url=url, **kwargs)
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 450, in request
Feb 10 14:49:35 katello-yoda celery: prep = self.prepare_request(req)
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 381, in prepare_request
Feb 10 14:49:35 katello-yoda celery: hooks=merge_hooks(request.hooks, self.hooks),
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib/python2.7/site-packages/requests/models.py", line 307, in prepare
Feb 10 14:49:35 katello-yoda celery: self.prepare_body(data, files, json)
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib/python2.7/site-packages/requests/models.py", line 427, in prepare_body
Feb 10 14:49:35 katello-yoda celery: body = json_dumps(json)
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib64/python2.7/site-packages/simplejson/__init__.py", line 354, in dumps
Feb 10 14:49:35 katello-yoda celery: return _default_encoder.encode(obj)
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib64/python2.7/site-packages/simplejson/encoder.py", line 262, in encode
Feb 10 14:49:35 katello-yoda celery: chunks = self.iterencode(o, _one_shot=True)
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib64/python2.7/site-packages/simplejson/encoder.py", line 340, in iterencode
Feb 10 14:49:35 katello-yoda celery: return _iterencode(o, 0)
Feb 10 14:49:35 katello-yoda celery: File "/usr/lib64/python2.7/site-packages/simplejson/encoder.py", line 239, in default
Feb 10 14:49:35 katello-yoda celery: raise TypeError(repr(o) + " is not JSON serializable")
Feb 10 14:49:35 katello-yoda celery: TypeError: ObjectId('56bb94480c5bf3b9573e45f7') is not JSON serializable
Feb 10 14:49:35 katello-yoda pulp: celery.worker.strategy:INFO: Received task: pulp.server.async.tasks._queue_reserved_task[3e8722ee-2506-434a-a742-65e2f0e9c32f]
Feb 10 14:49:35 katello-yoda pulp: celery.worker.job:INFO: Task pulp.server.managers.repo.sync.sync[45015bd6-d10f-4244-94de-85199b04aed0] succeeded in 7.63914956601s: <pulp.server.async.tasks.TaskResult object at 0x39f4110>
$ rpm -qa|grep pulp
python-pulp-common-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
python-pulp-docker-common-2.0.0-0.5.beta.git.10.3ce1ef2.el7.noarch
pulp-rpm-admin-extensions-2.8.0-0.5.beta.git.25.8b3df25.el7.noarch
pulp-nodes-admin-extensions-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
python-pulp-puppet-common-2.8.0-0.5.beta.git.4.2960d39.el7.noarch
pulp-admin-client-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-nodes-common-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
python-pulp-rpm-common-2.8.0-0.5.beta.git.25.8b3df25.el7.noarch
pulp-rpm-plugins-2.8.0-0.5.beta.git.25.8b3df25.el7.noarch
pulp-ostree-admin-extensions-1.1.0-0.5.beta.git.4.435a94d.el7.noarch
pulp-nodes-consumer-extensions-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-rpm-consumer-extensions-2.8.0-0.5.beta.git.25.8b3df25.el7.noarch
rubygem-smart_proxy_pulp-1.2.0-1.el7.noarch
pulp-puppet-plugins-2.8.0-0.5.beta.git.4.2960d39.el7.noarch
python-pulp-client-lib-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-server-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
python-pulp-python-common-1.1.0-0.2.beta.git.9.fe0500c.el7.noarch
pulp-python-plugins-1.1.0-0.2.beta.git.9.fe0500c.el7.noarch
pulp-docker-plugins-2.0.0-0.5.beta.git.10.3ce1ef2.el7.noarch
python-pulp-streamer-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-puppet-admin-extensions-2.8.0-0.5.beta.git.4.2960d39.el7.noarch
pulp-katello-1.0-1.el7.noarch
python-kombu-3.0.24-11.pulp.el7.noarch
python-isodate-0.5.0-4.pulp.el7.noarch
python-pulp-bindings-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
python-pulp-repoauth-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
python-pulp-ostree-common-1.1.0-0.5.beta.git.4.435a94d.el7.noarch
pulp-python-admin-extensions-1.1.0-0.2.beta.git.9.fe0500c.el7.noarch
pulp-docker-admin-extensions-2.0.0-0.5.beta.git.10.3ce1ef2.el7.noarch
pulp-nodes-parent-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-puppet-consumer-extensions-2.8.0-0.5.beta.git.4.2960d39.el7.noarch
pulp-consumer-client-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
python-pulp-oid_validation-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-ostree-plugins-1.1.0-0.5.beta.git.4.435a94d.el7.noarch
pulp-selinux-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch

Associated revisions

Revision 83e6020c View on GitHub
Added by Austin Macdonald over 4 years ago

Use bson's json serializer to handle ObjectIds before posting request.

Also, pass the importer_type_id because id maps to _id which is an ObjectId and incorrect.

closes #1657

Revision 83e6020c View on GitHub
Added by Austin Macdonald over 4 years ago

Use bson's json serializer to handle ObjectIds before posting request.

Also, pass the importer_type_id because id maps to _id which is an ObjectId and incorrect.

closes #1657

History

#1 Updated by paji@redhat.com over 4 years ago

On further investigation, Jeremy Cline found that this was the post data being sent by the event notifier. This is the data thats failing to get serialized.


> /usr/lib/python2.7/site-packages/pulp/server/event/http.py(56)_send_post()
-> response = post(url, json=data, auth=auth)
(Pdb) p data
{'call_report': {'exception': None, 'task_type': u'pulp.server.managers.repo.sync.sync', '_href': u'/pulp/api/v2/tasks/1a3e5b01-a5a0-4e97-b4b0-a262cf158f74/', 'task_id': u'1a3e5b01-a5a0-4e97-b4b0-a262cf158f74', 'tags': [u'pulp:repository:Default_Organization-mikey-justin', u'pulp:action:sync'], 'finish_time': None, '_ns': u'task_status', 'start_time': u'2016-02-10T19:59:18Z', 'traceback': None, 'spawned_tasks': [], 'progress_report': {u'yum_importer': {u'content': {u'items_total': 0, u'state': u'FINISHED', u'error_details': [], u'details': {u'rpm_total': 0, u'rpm_done': 0, u'drpm_total': 0, u'drpm_done': 0}, u'size_total': 0, u'size_left': 0, u'items_left': 0}, u'comps': {u'state': u'FINISHED'}, u'purge_duplicates': {u'state': u'FINISHED'}, u'distribution': {u'items_total': 0, u'state': u'FINISHED', u'error_details': [], u'items_left': 0}, u'errata': {u'state': u'FINISHED'}, u'metadata': {u'state': u'FINISHED'}}}, 'state': u'running', 'worker_name': u'reserved_resource_worker-1@katello-yoda.example.com', 'result': None, 'error': None, '_id': ObjectId('56bb96960c5bf3b9573e4621'), 'id': '56bb96960c5bf3b9573e4621'}, 'event_type': 'repo.sync.finish', 'payload': {'importer_id': ObjectId('56bb9434de0403104256f35b'), 'exception': None, 'repo_id': u'Default_Organization-mikey-justin', 'traceback': None, 'started': '2016-02-10T19:59:18Z', '_ns': u'repo_sync_results', 'completed': '2016-02-10T19:59:24Z', 'importer_type_id': u'yum_importer', 'error_message': None, 'summary': {'content': {'state': 'FINISHED'}, 'comps': {'state': 'FINISHED'}, 'purge_duplicates': {'state': 'FINISHED'}, 'distribution': {'state': 'FINISHED'}, 'errata': {'state': 'FINISHED'}, 'metadata': {'state': 'FINISHED'}}, 'added_count': 0, 'result': 'success', 'updated_count': 0, 'details': {'content': {'size_total': 0, 'items_left': 0, 'items_total': 0, 'state': 'FINISHED', 'size_left': 0, 'details': {'rpm_total': 0, 'rpm_done': 0, 'drpm_total': 0, 'drpm_done': 0}, 'error_details': []}, 'comps': {'state': 'FINISHED'}, 'purge_duplicates': {'state': 'FINISHED'}, 'distribution': {'items_total': 0, 'state': 'FINISHED', 'error_details': [], 'items_left': 0}, 'errata': {'state': 'FINISHED'}, 'metadata': {'state': 'FINISHED'}}, 'id': '56bb969cde04031a589bf41d', 'removed_count': 0}}
(Pdb) 

#2 Updated by amacdona@redhat.com over 4 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to amacdona@redhat.com
  • Platform Release set to 2.8.0
  • Tags Easy Fix added

This is a regression caused by the Mongoengine conversion of importers.

#3 Updated by amacdona@redhat.com over 4 years ago

  • Status changed from ASSIGNED to POST

#4 Updated by amacdona@redhat.com over 4 years ago

  • Triaged changed from No to Yes

#5 Updated by Anonymous over 4 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

#6 Updated by dkliban@redhat.com over 4 years ago

  • Status changed from MODIFIED to 5

#7 Updated by dkliban@redhat.com over 4 years ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE

#8 Updated by bmbouter over 1 year ago

  • Tags Pulp 2 added

#9 Updated by bmbouter 4 months ago

  • Category deleted (14)

We are removing the 'API' category per open floor discussion June 16, 2020.

Please register to edit this issue

Also available in: Atom PDF