awx icon indicating copy to clipboard operation
awx copied to clipboard

500 error after API call

Open therealrobopablo opened this issue 6 years ago • 40 comments

ISSUE TYPE
  • Bug Report
SUMMARY

We started testing API calls to AWX via ServiceNow. Suddenly we're getting "Invalid search term entered. GET returned: 500 A server error has occurred." when viewing job info after it finishes. Job monitoring works fine while job is running. It seems to be not affecting jobs that fail. We've been using an external PSQL db

ENVIRONMENT
  • AWX version: 11.0.0
  • AWX install method: docker on linux
  • Ansible version: 2.95
  • Operating System: CentOS7
  • Web Browser: Edge, chrome
STEPS TO REPRODUCE

PErform API call to AWX, job completes and then check job history and click on job link

EXPECTED RESULTS

job run info displays

ACTUAL RESULTS

Invalid search term entered. GET returned: 500 A server error has occurred.

ADDITIONAL INFORMATION

awx_web tail 2020-06-04 15:09:43,523 ERROR django.request Internal Server Error: /api/v2/project_updates/27792/ Traceback (most recent call last): File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/lib64/python3.6/contextlib.py", line 52, in inner return func(*args, **kwds) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(*args, **kwargs) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/api/generics.py", line 299, in dispatch return super(APIView, self).dispatch(request, *args, **kwargs) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/rest_framework/views.py", line 505, in dispatch response = self.handle_exception(exc) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/rest_framework/views.py", line 465, in handle_exception self.raise_uncaught_exception(exc) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception raise exc File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/rest_framework/views.py", line 502, in dispatch response = handler(request, *args, **kwargs) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/rest_framework/generics.py", line 208, in get return self.retrieve(request, *args, **kwargs) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/rest_framework/mixins.py", line 56, in retrieve return Response(serializer.data) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/rest_framework/serializers.py", line 562, in data ret = super().data File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/rest_framework/serializers.py", line 260, in data self._data = self.to_representation(self.instance) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/api/serializers.py", line 802, in to_representation ret = super(UnifiedJobSerializer, self).to_representation(obj) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/rest_framework/serializers.py", line 529, in to_representation ret[field.field_name] = field.to_representation(attribute) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/rest_framework/fields.py", line 1905, in to_representation return method(value) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/api/serializers.py", line 1515, in get_host_status_counts counts = obj.project_update_events.only('event_data').get(event='playbook_on_stats').get_host_status_counts() File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py", line 412, in get (self.model._meta.object_name, num) awx.main.models.events.ProjectUpdateEvent.MultipleObjectsReturned: get() returned more than one ProjectUpdateEvent -- it returned 3!

therealrobopablo avatar Jun 04 '20 16:06 therealrobopablo

Displaying completed management jobs seem to be OK.

therealrobopablo avatar Jun 04 '20 16:06 therealrobopablo

Most likely case here is that the callback receiver saved 3 duplicates of the playbook_on_stats event for the job.

https://github.com/ansible/awx/blob/4b02e4ab57f22017c80b3c2b29feaa64da486d70/awx/api/serializers.py#L1517

Could you try to confirm or deny this by going to /api/v2/project_updates/27792/events/?event=playbook_on_stats in your browser?

AlanCoding avatar Jun 05 '20 12:06 AlanCoding

Here;s the output on that. However I just realized this was maybe not the best example since it wasn't a workflow job, which is what's happening. I'll do the same with one that's more appropriate HTTP 200 OK Allow: GET, HEAD, OPTIONS Content-Type: application/json Vary: Accept X-API-Node: awx X-API-Product-Name: AWX X-API-Product-Version: 11.2.0 X-API-Time: 0.024s X-UI-Max-Events: 4000

{ "count": 3, "next": null, "previous": null, "results": [ { "id": 426721, "type": "project_update_event", "url": "", "related": { "project_update": "/api/v2/project_updates/27792/" }, "summary_fields": { "project_update": { "id": 27792, "name": "Yum_playbooks", "description": "", "status": "successful", "failed": false }, "role": {} }, "created": "2020-06-04T14:43:25.698014Z", "modified": "2020-06-04T14:43:25.804159Z", "event": "playbook_on_stats", "counter": 13, "event_display": "Playbook Complete", "event_data": { "playbook": "project_update.yml", "playbook_uuid": "a20f154e-aead-447a-bc67-016a1f8bdfb4", "changed": {}, "dark": {}, "failures": {}, "ignored": {}, "ok": { "localhost": 3 }, "processed": { "localhost": 1 }, "rescued": {}, "skipped": {}, "artifact_data": {}, "uuid": "70c75ac7-19e7-4051-8558-785f4dff565c" }, "event_level": 1, "failed": false, "changed": false, "uuid": "70c75ac7-19e7-4051-8558-785f4dff565c", "host_name": "localhost", "playbook": "project_update.yml", "play": "", "task": "", "role": "", "stdout": "\r\nPLAY RECAP *********************************************************************\r\n\u001b[0;32mlocalhost\u001b[0m : \u001b[0;32mok=3 \u001b[0m changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 \r\n", "start_line": 15, "end_line": 19, "verbosity": 0, "project_update": 27792 }, { "id": 426724, "type": "project_update_event", "url": "", "related": { "project_update": "/api/v2/project_updates/27792/" }, "summary_fields": { "project_update": { "id": 27792, "name": "Yum_playbooks", "description": "", "status": "successful", "failed": false }, "role": {} }, "created": "2020-06-04T14:43:25.953059Z", "modified": "2020-06-04T14:43:26.058365Z", "event": "playbook_on_stats", "counter": 13, "event_display": "Playbook Complete", "event_data": { "playbook": "project_update.yml", "playbook_uuid": "30730e96-eeda-4d36-946d-fe67d421af3a", "changed": {}, "dark": {}, "failures": {}, "ignored": {}, "ok": { "localhost": 3 }, "processed": { "localhost": 1 }, "rescued": {}, "skipped": {}, "artifact_data": {}, "uuid": "36d53497-cda2-4a91-8a5a-ef6a9c72de51" }, "event_level": 1, "failed": false, "changed": false, "uuid": "36d53497-cda2-4a91-8a5a-ef6a9c72de51", "host_name": "localhost", "playbook": "project_update.yml", "play": "", "task": "", "role": "", "stdout": "\r\nPLAY RECAP *********************************************************************\r\n\u001b[0;32mlocalhost\u001b[0m : \u001b[0;32mok=3 \u001b[0m changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 \r\n", "start_line": 15, "end_line": 19, "verbosity": 0, "project_update": 27792 }, { "id": 426737, "type": "project_update_event", "url": "", "related": { "project_update": "/api/v2/project_updates/27792/" }, "summary_fields": { "project_update": { "id": 27792, "name": "Yum_playbooks", "description": "", "status": "successful", "failed": false }, "role": {} }, "created": "2020-06-04T14:43:32.948684Z", "modified": "2020-06-04T14:43:33.069551Z", "event": "playbook_on_stats", "counter": 13, "event_display": "Playbook Complete", "event_data": { "playbook": "project_update.yml", "playbook_uuid": "a445b951-ea70-4df9-94b2-7611dcc77eea", "changed": {}, "dark": {}, "failures": {}, "ignored": {}, "ok": { "localhost": 3 }, "processed": { "localhost": 1 }, "rescued": {}, "skipped": {}, "artifact_data": {}, "uuid": "f8b2abf3-abb3-461c-a8b5-f62a1ea159bb" }, "event_level": 1, "failed": false, "changed": false, "uuid": "f8b2abf3-abb3-461c-a8b5-f62a1ea159bb", "host_name": "localhost", "playbook": "project_update.yml", "play": "", "task": "", "role": "", "stdout": "\r\nPLAY RECAP *********************************************************************\r\n\u001b[0;32mlocalhost\u001b[0m : \u001b[0;32mok=3 \u001b[0m changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 \r\n", "start_line": 15, "end_line": 19, "verbosity": 0, "project_update": 27792 } ] }

therealrobopablo avatar Jun 05 '20 13:06 therealrobopablo

This information certainly raises my interest.

Do you have any more information about the structure of the API calls that caused this? Did they hit /api/v2/jobs/N/launch/? Are the other events duplicated too (if you take off the event=playbook_on_stats filter, do you see 3 of each)? Is there anything else you did that might be relevant for replicating this?

AlanCoding avatar Jun 05 '20 14:06 AlanCoding

I've asked for a complete API call.

GET /api/v2/project_updates/27792/events/ HTTP 200 OK Allow: GET, HEAD, OPTIONS Content-Type: application/json Vary: Accept X-API-Node: awx X-API-Product-Name: AWX X-API-Product-Version: 11.2.0 X-API-Time: 0.044s X-UI-Max-Events: 4000

{ "name": "Project Update Events List", "description": "# List Project Update Events for a Project Update:\n\nMake a GET request to this resource to retrieve a list of\nproject update events associated with the selected\nproject update.\n\nThe resulting data structure contains:\n\n {\n "count": 99,\n "next": null,\n "previous": null,\n "results": [\n ...\n ]\n }\n\nThe count field indicates the total number of project update events\nfound for the given query. The next and previous fields provides links to\nadditional results if there are more than will fit on a single page. The\nresults list contains zero or more project update event records. \n\n## Results\n\nEach project update event data structure includes the following fields:\n\n* id: Database ID for this project update event. (integer)\n* type: Data type for this project update event. (choice)\n* url: URL for this project update event. (string)\n* related: Data structure with URLs of related resources. (object)\n* summary_fields: Data structure with name/description for related resources. The output for some objects may be limited for performance reasons. (object)\n* created: Timestamp when this project update event was created. (datetime)\n* modified: Timestamp when this project update event was last modified. (datetime)\n* event: (choice)\n - runner_on_failed: Host Failed\n - runner_on_start: Host Started\n - runner_on_ok: Host OK\n - runner_on_error: Host Failure\n - runner_on_skipped: Host Skipped\n - runner_on_unreachable: Host Unreachable\n - runner_on_no_hosts: No Hosts Remaining\n - runner_on_async_poll: Host Polling\n - runner_on_async_ok: Host Async OK\n - runner_on_async_failed: Host Async Failure\n - runner_item_on_ok: Item OK\n - runner_item_on_failed: Item Failed\n - runner_item_on_skipped: Item Skipped\n - runner_retry: Host Retry\n - runner_on_file_diff: File Difference\n - playbook_on_start: Playbook Started\n - playbook_on_notify: Running Handlers\n - playbook_on_include: Including File\n - playbook_on_no_hosts_matched: No Hosts Matched\n - playbook_on_no_hosts_remaining: No Hosts Remaining\n - playbook_on_task_start: Task Started\n - playbook_on_vars_prompt: Variables Prompted\n - playbook_on_setup: Gathering Facts\n - playbook_on_import_for_host: internal: on Import for Host\n - playbook_on_not_import_for_host: internal: on Not Import for Host\n - playbook_on_play_start: Play Started\n - playbook_on_stats: Playbook Complete\n - debug: Debug\n - verbose: Verbose\n - deprecated: Deprecated\n - warning: Warning\n - system_warning: System Warning\n - error: Error\n* counter: (integer)\n* event_display: (string)\n* event_data: (json)\n* event_level: (integer)\n* failed: (boolean)\n* changed: (boolean)\n* uuid: (string)\n* host_name: (field)\n* playbook: (string)\n* play: (string)\n* task: (string)\n* role: (string)\n* stdout: (field)\n* start_line: (integer)\n* end_line: (integer)\n* verbosity: (integer)\n* project_update: (id)\n\n\n\n## Sorting\n\nTo specify that project update events are returned in a particular\norder, use the order_by query string parameter on the GET request.\n\n ?order_by=name\n\nPrefix the field name with a dash - to sort in reverse:\n\n ?order_by=-name\n\nMultiple sorting fields may be specified by separating the field names with a\ncomma ,:\n\n ?order_by=name,some_other_field\n\n## Pagination\n\nUse the page_size query string parameter to change the number of results\nreturned for each request. Use the page query string parameter to retrieve\na particular page of results.\n\n ?page_size=100&page=2\n\nThe previous and next links returned with the results will set these query\nstring parameters automatically.\n\n## Searching\n\nUse the search query string parameter to perform a case-insensitive search\nwithin all designated text fields of a model.\n\n ?search=findme\n\n(Added in Ansible Tower 3.1.0) Search across related fields:\n\n ?related__search=findme\n\nNote: If you want to provide more than one search term, multiple\nsearch fields with the same key, like ?related__search=foo&related__search=bar,\nwill be ORed together. Terms separated by commas, like ?related__search=foo,bar\nwill be ANDed together.\n\n## Filtering\n\nAny additional query string parameters may be used to filter the list of\nresults returned to those matching a given value. Only fields and relations\nthat exist in the database may be used for filtering. Any special characters\nin the specified value should be url-encoded. For example:\n\n ?field=value%20xyz\n\nFields may also span relations, only for fields and relationships defined in\nthe database:\n\n ?other__field=value\n\nTo exclude results matching certain criteria, prefix the field parameter with\nnot__:\n\n ?not__field=value\n\nBy default, all query string filters are AND'ed together, so\nonly the results matching all filters will be returned. To combine results\nmatching any one of multiple criteria, prefix each query string parameter\nwith or__:\n\n ?or__field=value&or__field=othervalue\n ?or__not__field=value&or__field=othervalue\n\n(Added in Ansible Tower 1.4.5) The default AND filtering applies all filters\nsimultaneously to each related object being filtered across database\nrelationships. The chain filter instead applies filters separately for each\nrelated object. To use, prefix the query string parameter with chain__:\n\n ?chain__related__field=value&chain__related__field2=othervalue\n ?chain__not__related__field=value&chain__related__field2=othervalue\n\nIf the first query above were written as\n?related__field=value&related__field2=othervalue, it would return only the\nprimary objects where the same related object satisfied both conditions. As\nwritten using the chain filter, it would return the intersection of primary\nobjects matching each condition.\n\nField lookups may also be used for more advanced queries, by appending the\nlookup to the field name:\n\n ?field__lookup=value\n\nThe following field lookups are supported:\n\n* exact: Exact match (default lookup if not specified).\n* iexact: Case-insensitive version of exact.\n* contains: Field contains value.\n* icontains: Case-insensitive version of contains.\n* startswith: Field starts with value.\n* istartswith: Case-insensitive version of startswith.\n* endswith: Field ends with value.\n* iendswith: Case-insensitive version of endswith.\n* regex: Field matches the given regular expression.\n* iregex: Case-insensitive version of regex.\n* gt: Greater than comparison.\n* gte: Greater than or equal to comparison.\n* lt: Less than comparison.\n* lte: Less than or equal to comparison.\n* isnull: Check whether the given field or related object is null; expects a\n boolean value.\n* in: Check whether the given field's value is present in the list provided;\n expects a list of items.\n\nBoolean values may be specified as True or 1 for true, False or 0 for\nfalse (both case-insensitive).\n\nNull values may be specified as None or Null (both case-insensitive),\nthough it is preferred to use the isnull lookup to explicitly check for null\nvalues.\n\nLists (for the in lookup) may be specified as a comma-separated list of\nvalues.\n\n(Added in Ansible Tower 3.1.0) Filtering based on the requesting user's\nlevel of access by query string parameter.\n\n* role_level: Level of role to filter on, such as admin_role", "renders": [ "application/json", "text/html" ], "parses": [ "application/json" ], "actions": { "GET": { "id": { "type": "integer", "label": "ID", "help_text": "Database ID for this project update event.", "filterable": true }, "type": { "type": "choice", "label": "Type", "help_text": "Data type for this project update event.", "filterable": true, "choices": [ [ "project_update_event", "Project Update Event" ] ] }, "url": { "type": "string", "label": "Url", "help_text": "URL for this project update event.", "filterable": false }, "related": { "type": "object", "label": "Related", "help_text": "Data structure with URLs of related resources.", "filterable": false }, "summary_fields": { "type": "object", "label": "Summary fields", "help_text": "Data structure with name/description for related resources. The output for some objects may be limited for performance reasons.", "filterable": false }, "created": { "type": "datetime", "label": "Created", "help_text": "Timestamp when this project update event was created.", "filterable": true }, "modified": { "type": "datetime", "label": "Modified", "help_text": "Timestamp when this project update event was last modified.", "filterable": true }, "event": { "type": "choice", "label": "Event", "filterable": true, "choices": [ [ "runner_on_failed", "Host Failed" ], [ "runner_on_start", "Host Started" ], [ "runner_on_ok", "Host OK" ], [ "runner_on_error", "Host Failure" ], [ "runner_on_skipped", "Host Skipped" ], [ "runner_on_unreachable", "Host Unreachable" ], [ "runner_on_no_hosts", "No Hosts Remaining" ], [ "runner_on_async_poll", "Host Polling" ], [ "runner_on_async_ok", "Host Async OK" ], [ "runner_on_async_failed", "Host Async Failure" ], [ "runner_item_on_ok", "Item OK" ], [ "runner_item_on_failed", "Item Failed" ], [ "runner_item_on_skipped", "Item Skipped" ], [ "runner_retry", "Host Retry" ], [ "runner_on_file_diff", "File Difference" ], [ "playbook_on_start", "Playbook Started" ], [ "playbook_on_notify", "Running Handlers" ], [ "playbook_on_include", "Including File" ], [ "playbook_on_no_hosts_matched", "No Hosts Matched" ], [ "playbook_on_no_hosts_remaining", "No Hosts Remaining" ], [ "playbook_on_task_start", "Task Started" ], [ "playbook_on_vars_prompt", "Variables Prompted" ], [ "playbook_on_setup", "Gathering Facts" ], [ "playbook_on_import_for_host", "internal: on Import for Host" ], [ "playbook_on_not_import_for_host", "internal: on Not Import for Host" ], [ "playbook_on_play_start", "Play Started" ], [ "playbook_on_stats", "Playbook Complete" ], [ "debug", "Debug" ], [ "verbose", "Verbose" ], [ "deprecated", "Deprecated" ], [ "warning", "Warning" ], [ "system_warning", "System Warning" ], [ "error", "Error" ] ] }, "counter": { "type": "integer", "label": "Counter", "min_value": 0, "filterable": true }, "event_display": { "type": "string", "label": "Event display", "filterable": false }, "event_data": { "type": "json", "label": "Event data", "filterable": true }, "event_level": { "type": "integer", "label": "Event level", "filterable": false }, "failed": { "type": "boolean", "label": "Failed", "filterable": true }, "changed": { "type": "boolean", "label": "Changed", "filterable": true }, "uuid": { "type": "string", "label": "Uuid", "filterable": true }, "host_name": { "type": "field", "label": "Host name", "filterable": false }, "playbook": { "type": "string", "label": "Playbook", "filterable": true }, "play": { "type": "string", "label": "Play", "filterable": true }, "task": { "type": "string", "label": "Task", "filterable": true }, "role": { "type": "string", "label": "Role", "filterable": true }, "stdout": { "type": "field", "label": "Stdout", "filterable": true }, "start_line": { "type": "integer", "label": "Start line", "min_value": 0, "filterable": true }, "end_line": { "type": "integer", "label": "End line", "min_value": 0, "filterable": true }, "verbosity": { "type": "integer", "label": "Verbosity", "min_value": 0, "filterable": true }, "project_update": { "type": "id", "label": "Project update", "filterable": true } } }, "types": [ "project_update_event" ], "search_fields": [ "stdout" ], "related_search_fields": [ "project_update__search" ], "max_page_size": 200 }

therealrobopablo avatar Jun 05 '20 15:06 therealrobopablo

Here's an API output of the workflow template and the resulting jobs: GET /api/v2/workflow_jobs/27807/ { "id": 27807, "type": "workflow_job", "url": "/api/v2/workflow_jobs/27807/", "related": { "created_by": "/api/v2/users/3/", "modified_by": "/api/v2/users/3/", "unified_job_template": "/api/v2/workflow_job_templates/71/", "workflow_job_template": "/api/v2/workflow_job_templates/71/", "notifications": "/api/v2/workflow_jobs/27807/notifications/", "workflow_nodes": "/api/v2/workflow_jobs/27807/workflow_nodes/", "labels": "/api/v2/workflow_jobs/27807/labels/", "activity_stream": "/api/v2/workflow_jobs/27807/activity_stream/", "relaunch": "/api/v2/workflow_jobs/27807/relaunch/", "cancel": "/api/v2/workflow_jobs/27807/cancel/" }, "summary_fields": { "organization": { "id": 2, "name": "HP", "description": "" }, "inventory": { "id": 29, "name": "Blank", "description": "", "has_active_failures": false, "total_hosts": 0, "hosts_with_active_failures": 0, "total_groups": 2, "has_inventory_sources": false, "total_inventory_sources": 0, "inventory_sources_with_failures": 0, "organization_id": 2, "kind": "" }, "workflow_job_template": { "id": 71, "name": "HPIT_AWX_Linux_Builds_Virtual", "description": "building linux VMs" }, "unified_job_template": { "id": 71, "name": "HPIT_AWX_Linux_Builds_Virtual", "description": "building linux VMs", "unified_job_type": "workflow_job" }, "created_by": { "id": 3, "username": "wilsonpa", "first_name": "Paul", "last_name": "Wilson" }, "modified_by": { "id": 3, "username": "wilsonpa", "first_name": "Paul", "last_name": "Wilson" }, "user_capabilities": { "delete": true, "start": true }, "labels": { "count": 0, "results": [] } }, "created": "2020-06-04T20:58:35.405189Z", "modified": "2020-06-04T20:58:36.149867Z", "name": "HPIT_AWX_Linux_Builds_Virtual", "description": "building linux VMs", "unified_job_template": 71, "launch_type": "relaunch", "status": "successful", "failed": false, "started": "2020-06-04T20:58:36.143345Z", "finished": "2020-06-04T21:04:08.327791Z", "canceled_on": null, "elapsed": 332.184, "job_args": "", "job_cwd": "", "job_env": {}, "job_explanation": "", "result_traceback": "", "workflow_job_template": 71, "extra_vars": "{"hostname": "v790", "ip_address": "15.63.225.200", "location": "15.63.225.253", "resource_type": "virtual", "platform": "x86", "device_class": "linux", "operating_system": "centos_7", "cpu": 2, "memory": 8192, "storage": [10, 10, 10, 10], "resource_function": "Application Server", "functional_software": "", "clustering_services": "Service Guard Local", "network_segment": "VM Network"}", "allow_simultaneous": false, "job_template": null, "is_sliced_job": false, "inventory": 29, "limit": null, "scm_branch": null, "webhook_service": "", "webhook_credential": null, "webhook_guid": "" }

When I try API calls to see the templates imitated by the workflow I get no results.

GET /api/v2/jobs/27810/ TTP 500 Internal Server Error Content-Type: application/json Vary: Accept

{ "detail": "A server error has occurred." }

but if I look at the database I see the attached.

image

It looks like this has maybe damaged the database, as well, since the 500 is also popping up on random job checks .

therealrobopablo avatar Jun 05 '20 16:06 therealrobopablo

see also https://github.com/ansible/awx/issues/6982

wenottingham avatar Jun 05 '20 16:06 wenottingham

see also #6982

I saw that when I was initially researching. It 'ed me down a good path, but didn't tell me a solid way to fix it. I'm not a DBA so monkeying with the DB is daunting...

therealrobopablo avatar Jun 05 '20 17:06 therealrobopablo

Here's an example API POST command:

http://AWX_SERVER/api/v2/workflow_job_templates/71/launch/

{ "extra_vars": { "hostname":"testvm1000", "ip_address":"xxx.xxx.xxx.xxx", "location":"xxx.xxx.xxx.xxx", "resource_type":"virtual", "platform":"x86", "device_class":"linux", "operating_system":"rhel_7", "cpu":2, "memory":8192, "storage":[10, 10, 10], "resource_function":"application_server", "functional_software":"apache", "clustering_services":"service_guard_local", "network_segment":"VM Network" } }

there are 2 templates in the workflow, a VM build and then some package installs, post build. The workflow completes and I can click on the jobs tab and see the info there, but the templated jobs are the ones throwing a 500. But as I stated earlier it seems like the 500s also show up in other jobs like SCM update etc

therealrobopablo avatar Jun 05 '20 17:06 therealrobopablo

The workflow completes and I can click on the jobs tab and see the info there, but the templated jobs are the ones throwing a 500.

What do you mean by "templated jobs"? Jobs from job templates should show in the jobs list in the UI. Do you mean that you get the error when you click on the link for a specific job run?

AlanCoding avatar Jun 06 '20 17:06 AlanCoding

What do you mean by "templated jobs"? Jobs from job templates should show in the jobs list in the UI. Do you mean that you get the error when you click on the link for a specific job run?

I click on the "JOBS" tab and click on the complete workflow job, it opens and shows job details. If I then click on the jobs associated with the workflow, it throws the 500 error. That also happens if I click the job itself on the Jobs tab. I'll add some screen shots.

The other weird thing is I can watch the jobs as they run. This only happens after completion. The jobs do complete though.

image

image

image

therealrobopablo avatar Jun 07 '20 14:06 therealrobopablo

@therealrobopablo can you share a listing of your Docker containers e.g., docker ps -a ?

ryanpetrello avatar Jun 26 '20 17:06 ryanpetrello

@ryanpetrello CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 21f2f2b15344 ansible/awx_task:11.0.0 "tini -- /bin/sh -c …" 2 months ago Up 2 weeks 8052/tcp awx_task c79af6843c31 ansible/awx_web:11.0.0 "tini -- /bin/sh -c …" 2 months ago Up 3 weeks 0.0.0.0:80->8052/tcp awx_web c836df808559 redis "docker-entrypoint.s…" 2 months ago Up 3 weeks 6379/tcp awx_redis 43d22f763f17 memcached:alpine "docker-entrypoint.s…" 2 months ago Up 3 weeks 11211/tcp awx_memcached

therealrobopablo avatar Jul 01 '20 18:07 therealrobopablo

me too, i have the same issue

bouluad avatar Jul 02 '20 13:07 bouluad

@therealrobopablo AWX API responses are reporting version 11.2.0 X-API-Product-Version: 11.2.0 but your containers are 11.0.0

chrismeyersfsu avatar Jul 02 '20 14:07 chrismeyersfsu

So one way I've been able to reproduce this:

image

...is by intentionally running multiple distinct awx-manage run_dispatcher processes in the task container (on top of what supervisord manages).

@therealrobopablo can you share ps -ef inside the awx_task container?

ryanpetrello avatar Jul 02 '20 14:07 ryanpetrello

If i can help, I have the same, this is the ps for my awx_task container :

sh-4.4# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 12:12 ? 00:00:00 tini -- /bin/sh -c /usr/bin/launch_awx_task.sh root 6 1 0 12:12 ? 00:00:00 bash /usr/bin/launch_awx_task.sh root 98 6 0 12:12 ? 00:00:06 /usr/bin/python3.6 /usr/local/bin/supervisord -c /supervisor_task.conf root 101 98 0 12:12 ? 00:00:00 python3 /usr/bin/config-watcher root 102 98 0 12:12 ? 00:00:10 /var/lib/awx/venv/awx/bin/python3 /usr/bin/awx-manage run_dispatcher root 103 98 0 12:12 ? 00:00:03 /var/lib/awx/venv/awx/bin/python3 /usr/bin/awx-manage run_callback_receiver root 114 102 0 12:13 ? 00:00:06 /var/lib/awx/venv/awx/bin/python3 /usr/bin/awx-manage run_dispatcher root 115 103 0 12:13 ? 00:00:42 /var/lib/awx/venv/awx/bin/python3 /usr/bin/awx-manage run_callback_receiver root 116 103 0 12:13 ? 00:00:42 /var/lib/awx/venv/awx/bin/python3 /usr/bin/awx-manage run_callback_receiver root 117 103 0 12:13 ? 00:00:42 /var/lib/awx/venv/awx/bin/python3 /usr/bin/awx-manage run_callback_receiver root 118 103 0 12:13 ? 00:00:42 /var/lib/awx/venv/awx/bin/python3 /usr/bin/awx-manage run_callback_receiver root 326 102 0 12:51 ? 00:00:11 [awx-manage] root 346 102 0 13:33 ? 00:00:15 /var/lib/awx/venv/awx/bin/python3 /usr/bin/awx-manage run_dispatcher root 389 102 0 13:58 ? 00:00:11 /var/lib/awx/venv/awx/bin/python3 /usr/bin/awx-manage run_dispatcher root 392 102 0 14:31 ? 00:00:07 /var/lib/awx/venv/awx/bin/python3 /usr/bin/awx-manage run_dispatcher root 395 102 0 14:36 ? 00:00:07 /var/lib/awx/venv/awx/bin/python3 /usr/bin/awx-manage run_dispatcher

bouluad avatar Jul 02 '20 16:07 bouluad

@bouluad,

Are you seeing the error for all project updates you run (as in, are you able to run one right now, and see the error?)

ryanpetrello avatar Jul 02 '20 16:07 ryanpetrello

@ryanpetrello Yes for all project updates and also for all jobs; i have exactly the same error (by the UI) mentionned by @therealrobopablo

bouluad avatar Jul 02 '20 16:07 bouluad

@bouluad what version of AWX are you running? You can find it under /api/v2/config/.

ryanpetrello avatar Jul 02 '20 16:07 ryanpetrello