Skip to content

Conversation

@justinc1
Copy link
Collaborator

@justinc1 justinc1 commented Jul 3, 2023

I had problem figuring out why Ansible task fails with "500 Internal server error". The PR helps by logging HTTP requests/responses into a log file, and we can do post-mortem analysis.

My sample problem become obvious. Two subsequent requests are shown:

tail -f /tmp/q
41.6s _request: 
      request_in={'data': None, 'headers': {'Accept': 'application/json', 'Cookie': 'sessionID=cad85149-2418-4d17-b5b3-e190d1cf647e'}, 'method': 'DELETE', 'path': 'https://172.31.6.11/rest/v1/VirDomainBlockDevice/a795ef22-4f5b-43e3-94cb-d1fb1ea53462', 'timeout': 60.0},
      request_out={'data': b'{"taskTag":"449","createdUUID":""}', 'headers': {'access-control-allow-origin': '*', 'connection': 'close', 'content-length': '34', 'content-type': 'application/json; charset=utf-8', 'date': 'Mon, 03 Jul 2023 06:34:43 GMT', 'etag': 'W/"22-kVOpzzeFufx3JRxg6nc1xBl9aYI"', 'server': 'nginx', 'strict-transport-security': 'max-age=31536000', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-openapi-enforcer': 'controller', 'x-powered-by': 'Express', 'x-xss-protection': '1; mode=block'}, 'status': 200}

41.6s _request: 
      request_in={'data': '[{"virDomainUUID":"91a3657a-28d7-4e69-af3e-34d10cab4b1e","actionType":"START","cause":"INTERNAL"}]', 'headers': {'Accept': 'application/json', 'Content-type': 'application/json', 'Cookie': 'sessionID=cad85149-2418-4d17-b5b3-e190d1cf647e'}, 'method': 'POST', 'path': 'https://172.31.6.11/rest/v1/VirDomain/action', 'timeout': 60.0},
      request_out={'data': b'{"error":"An internal error occurred"}', 'headers': {'access-control-allow-origin': '*', 'connection': 'close', 'content-length': '38', 'content-type': 'application/json; charset=utf-8', 'date': 'Mon, 03 Jul 2023 06:34:43 GMT', 'etag': 'W/"26-6QmJuLmMIMO3P2eodnNgF/C4NMI"', 'server': 'nginx', 'x-powered-by': 'Express'}, 'status': 500}

After disk delete I forgot to call TaskTag wait, before starting VM.

@justinc1 justinc1 requested review from PolonaM and anazobec July 3, 2023 07:59
Copy link
Collaborator

@anazobec anazobec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you 👍 :)

DEVELOPMENT.md Outdated

## Debugging

A requests sent to and responses from HyperCore can be written to a file for debugging.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small sentence change suggestion. Everything else looks good and all the tests pass, so approving. :)
A requests sent to and responses ..., was it meant to be something like A dict of requests ... or A list of requests ...? If not, then it might be easier to read if it was something like Requests sent to and responses received from ....

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be better, ty.

Signed-off-by: Justin Cinkelj <justin.cinkelj@xlab.si>
@justinc1 justinc1 merged commit 3a312fd into main Jul 4, 2023
@justinc1 justinc1 deleted the request-logging branch July 4, 2023 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants