Skip to content

wait_tasks exceptions.ServiceException: (500) socket hang up #44

@zh0uhaiwei

Description

@zh0uhaiwei

wait_tasks([with_task_obj.task_id for with_task_obj in resp if with_task_obj.task_id],client)

当我们调用wait_tasks,经常出现:
Traceback (most recent call last):
File "O:/mywork/mywork/mywork/mypy/myvsphere2/cloud/set-user-from-cmdb.py", line 705, in
main()
File "O:/mywork/mywork/mywork/mypy/myvsphere2/cloud/set-user-from-cmdb.py", line 691, in main
set_user_form_smartx(vc_ip)
File "O:/mywork/mywork/mywork/mypy/myvsphere2/cloud/set-user-from-cmdb.py", line 601, in set_user_form_smartx
wait_tasks([with_task_obj.task_id for with_task_obj in resp if with_task_obj.task_id],client)
File "D:\Python3.74\lib\site-packages\cloudtower\utils.py", line 76, in wait_tasks
id_in=ids
File "D:\Python3.74\lib\site-packages\cloudtower\api\task_api.py", line 209, in get_tasks
return self.get_tasks_with_http_info(get_tasks_request_body, **kwargs) # noqa: E501
File "D:\Python3.74\lib\site-packages\cloudtower\api\task_api.py", line 330, in get_tasks_with_http_info
_request_auth=local_var_params.get('_request_auth'))
File "D:\Python3.74\lib\site-packages\cloudtower\api_client.py", line 380, in call_api
_request_auth)
File "D:\Python3.74\lib\site-packages\cloudtower\api_client.py", line 191, in __call_api
raise e
File "D:\Python3.74\lib\site-packages\cloudtower\api_client.py", line 188, in __call_api
_request_timeout=_request_timeout)
File "D:\Python3.74\lib\site-packages\cloudtower\api_client.py", line 424, in request
body=body)
File "D:\Python3.74\lib\site-packages\cloudtower\rest.py", line 267, in POST
body=body)
File "D:\Python3.74\lib\site-packages\cloudtower\rest.py", line 218, in request
raise ServiceException(http_resp=r)
cloudtower.exceptions.ServiceException: (500)
Reason: Internal Server Error
HTTP response headers: HTTPHeaderDict({'Date': 'Thu, 25 Sep 2025 09:03:15 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '671', 'Connection': 'keep-alive', 'Vary': 'Origin', 'x-tower-request-id': 'XxdA5NiavZC2NDm6arUnA'})
HTTP response body: {"path":"/get-tasks","status":500,"message":"request to http://cloudtower-cloudtower.cloudtower-system.svc.cluster.local.:8800/ failed, reason: socket hang up","stack":"FetchError: request to http://cloudtower-cloudtower.cloudtower-system.svc.cluster.local.:8800/ failed, reason: socket hang up\n at ClientRequest. (/app/node_modules/node-fetch/lib/index.js:1501:11)\n at ClientRequest.emit (node:events:518:28)\n at Socket.socketOnEnd (node:_http_client:524:9)\n at Socket.emit (node:events:530:35)\n at endReadableNT (node:internal/streams/readable:1696:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"}

请如如何增加backoffretry,可以给出示例吗?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions