Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't log traceback for http exceptions #930

Closed
TheTechromancer opened this issue Dec 22, 2023 · 1 comment
Closed

Don't log traceback for http exceptions #930

TheTechromancer opened this issue Dec 22, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@TheTechromancer
Copy link
Collaborator

Logging tracebacks for web exceptions results in a lot of overhead:

2023-12-22 20:52:33,248 [TRACE] bbot.core.helpers.web web.py:619 Unhandled exception with request to URL: https://evilcorp.com/common/admin/Calendar/Telerik.Web.UI.DialogHandler.aspx?dp=1: 
2023-12-22 20:52:33,249 [TRACE] bbot.core.helpers.web web.py:620 Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/bbot_dev-KnMjRjwb/lib/python3.10/site-packages/anyio/_core/_tasks.py", line 115, in fail_after
    yield cancel_scope
  File "/root/.local/share/virtualenvs/bbot_dev-KnMjRjwb/lib/python3.10/site-packages/httpcore/_synchronization.py", line 125, in wait
    await self._anyio_event.wait()
  File "/root/.local/share/virtualenvs/bbot_dev-KnMjRjwb/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 1616, in wait
    await self._event.wait()
  File "/usr/lib/python3.10/asyncio/locks.py", line 214, in wait
    await fut
asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f3c31ccc970

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/bbot_dev-KnMjRjwb/lib/python3.10/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
    yield
  File "/root/.local/share/virtualenvs/bbot_dev-KnMjRjwb/lib/python3.10/site-packages/httpcore/_synchronization.py", line 124, in wait
    with anyio.fail_after(timeout):
  File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/root/.local/share/virtualenvs/bbot_dev-KnMjRjwb/lib/python3.10/site-packages/anyio/_core/_tasks.py", line 118, in fail_after
    raise TimeoutError
TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/bbot_dev-KnMjRjwb/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 233, in handle_async_request
    connection = await status.wait_for_connection(timeout=timeout)
  File "/root/.local/share/virtualenvs/bbot_dev-KnMjRjwb/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 35, in wait_for_connection
    await self._connection_acquired.wait(timeout=timeout)
  File "/root/.local/share/virtualenvs/bbot_dev-KnMjRjwb/lib/python3.10/site-packages/httpcore/_synchronization.py", line 123, in wait
    with map_exceptions(anyio_exc_map):
  File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/root/.local/share/virtualenvs/bbot_dev-KnMjRjwb/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.PoolTimeout
@TheTechromancer
Copy link
Collaborator Author

Fixed in #937.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant