sanitizers / octomachinery

🤖 Invisible engine driving octobot machines. Simple, yet powerful. [DEMO BOT @ https://github.com/sanitizers/chronographer-github-app] | [tutorial @ https://tutorial.octomachinery.dev] | [docs @ https://docs.octomachinery.dev] | official web-site is at -->
https://octomachinery.dev
GNU General Public License v3.0
56 stars 12 forks source link

[TODO] Think about gracefully handling `GitHubBroken: Server Error` #48

Open sentry-io[bot] opened 3 years ago

sentry-io[bot] commented 3 years ago

Sentry Issue: PATCHBACK-N

CancelledError: 
  File "octomachinery/utils/asynctools.py", line 43, in _aio_gather_iter_pairs
    yield await task_res_q.get()
  File "anyio/_backends/_asyncio.py", line 724, in get
    return await super().get()
  File "asyncio/queues.py", line 163, in get
    await getter

GitHubBroken: Server Error
(21 additional frame(s) were not displayed)
...
  File "octomachinery/github/api/utils.py", line 45, in async_function_wrapper
    return await coroutine_instance
  File "gidgethub/abc.py", line 166, in post
    data, _ = await self._make_request(
  File "octomachinery/github/api/raw_client.py", line 66, in _make_request
    return await super()._make_request(
  File "gidgethub/abc.py", line 106, in _make_request
    data, self.rate_limit, more = sansio.decipher_response(*response)
  File "gidgethub/sansio.py", line 366, in decipher_response
    raise exc_type(*args)

Fund with Polar

webknjaz commented 3 years ago

GitHub API HTTP response headers example:

{
Content-Length: '32', 
Content-Type: 'application/json', 
Date: 'Wed, 20 Oct 2021 01:01:25 GMT', 
ETag: '"616f5c1c-20"', 
Server: 'GitHub.com', 
Vary: 'Accept-Encoding, Accept, X-Requested-With', 
X-GitHub-Request-Id: 'BA7E:646A:40B9F57:42AF99B:616F6A5B'
}
status_code_enum = <HTTPStatus.BAD_GATEWAY: 502>

GitHub API response payload:

{
  "message": "Server Error"
}
sentry-io[bot] commented 7 months ago

Sentry Issue: PATCHBACK-1T

CancelledError: null
  File "octomachinery/utils/asynctools.py", line 43, in _aio_gather_iter_pairs
    yield await task_res_q.get()
  File "anyio/_backends/_asyncio.py", line 724, in get
    return await super().get()
  File "asyncio/queues.py", line 166, in get
    await getter
GitHubBroken: Internal Server Error
  File "octomachinery/routing/webhooks_dispatcher.py", line 84, in route_github_event
    return await github_app.dispatch_event(github_event)
  File "octomachinery/github/api/app_client.py", line 64, in dispatch_event
    return await github_event.dispatch_via(
  File "octomachinery/github/models/events.py", line 146, in dispatch_via
    await aio_gather(*(
  File "octomachinery/utils/asynctools.py", line 54, in aio_gather
    result_pairs_gen = [_r async for _r in _aio_gather_iter_pairs(*aio_tasks)]
  File "octomachinery/utils/asynctools.py", line 54, in <listcomp>
    result_pairs_gen = [_r async for _r in _aio_gather_iter_pairs(*aio_tasks)]
  File "octomachinery/utils/asynctools.py", line 43, in _aio_gather_iter_pairs
    yield await task_res_q.get()
  File "anyio/_backends/_asyncio.py", line 392, in __aexit__
    raise exceptions[0]
  File "anyio/_backends/_asyncio.py", line 415, in _run_wrapped_task
    await func(*args)
  File "octomachinery/utils/asynctools.py", line 21, in _send_task_res_to_q
    task_res = await aio_task
  File "octomachinery/routing/routers.py", line 79, in dispatch
    await aio_gather(*callback_coros)
  File "octomachinery/utils/asynctools.py", line 54, in aio_gather
    result_pairs_gen = [_r async for _r in _aio_gather_iter_pairs(*aio_tasks)]
  File "octomachinery/utils/asynctools.py", line 54, in <listcomp>
    result_pairs_gen = [_r async for _r in _aio_gather_iter_pairs(*aio_tasks)]
  File "octomachinery/utils/asynctools.py", line 43, in _aio_gather_iter_pairs
    yield await task_res_q.get()
  File "anyio/_backends/_asyncio.py", line 392, in __aexit__
    raise exceptions[0]
  File "anyio/_backends/_asyncio.py", line 415, in _run_wrapped_task
    await func(*args)
  File "octomachinery/utils/asynctools.py", line 21, in _send_task_res_to_q
    task_res = await aio_task
  File "patchback/event_handlers.py", line 99, in event_handler_wrapper
    return await event_handler(
  File "patchback/event_handlers.py", line 244, in on_merge_of_labeled_pr
    repo_config = await get_patchback_config()
  File "patchback/config.py", line 41, in get_patchback_config
    await get_installation_config(config_name='patchback.yml', ref=ref)
  File "octomachinery/app/runtime/installation_utils.py", line 107, in get_installation_config
    config_content = await read_file_contents_from_repo(
  File "octomachinery/app/runtime/installation_utils.py", line 85, in read_file_contents_from_repo
    return await _get_file_contents_from_api(file_path, ref)
  File "octomachinery/app/runtime/installation_utils.py", line 42, in _get_file_contents_from_api
    config_response = await github_api.getitem(
  File "octomachinery/github/api/utils.py", line 45, in async_function_wrapper
    return await coroutine_instance
  File "gidgethub/abc.py", line 125, in getitem
    data, _ = await self._make_request(
  File "octomachinery/github/api/raw_client.py", line 66, in _make_request
    return await super()._make_request(
  File "gidgethub/abc.py", line 106, in _make_request
    data, self.rate_limit, more = sansio.decipher_response(*response)
  File "gidgethub/sansio.py", line 366, in decipher_response
    raise exc_type(*args)