7
5
Fork
You've already forked matteridge
3

ConnectTimeout traces in the logs #8

Open
opened 2025年04月11日 07:08:10 +02:00 by nicoco · 2 comments

Probably some temporary server failures that we should handle without polluting the logs with this massive trace.

ERROR:slidge.core.dispatcher.util:Failed to handle incoming stanza: (<slidge.core.dispatcher.session_dispatcher.SessionDispatcher object at 0x7f6a864dc050>, <presence to="<redacted>@mattermost.slidge.im" from="nicoco@slidge.im/Cheogram.0gFH" xml:lang="en"><c xmlns="http://jabber.org/protocol/caps" ver="hAx0qhppW5/ZjrpXmbXW0F2SJVM=" node="https://cheogram.com" hash="sha-1" /><x xmlns="vcard-temp:x:update"><photo>5cddf9baa11eccc64518a2bc84ca3003a9945603</photo></x></presence>)
Traceback (most recent call last):
 File "/venv/lib/python3.13/site-packages/anyio/_core/_tasks.py", line 115, in fail_after
 yield cancel_scope
 File "/venv/lib/python3.13/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp
 stream: anyio.abc.ByteStream = await anyio.connect_tcp(
 ^^^^^^^^^^^^^^^^^^^^^^^^
 ...<3 lines>...
 )
 ^
 File "/venv/lib/python3.13/site-packages/anyio/_core/_sockets.py", line 228, in connect_tcp
 async with create_task_group() as tg:
 ~~~~~~~~~~~~~~~~~^^
 File "/venv/lib/python3.13/site-packages/anyio/_backends/_asyncio.py", line 776, in __aexit__
 raise exc_val
 File "/venv/lib/python3.13/site-packages/anyio/_core/_sockets.py", line 233, in connect_tcp
 await event.wait()
 File "/venv/lib/python3.13/site-packages/anyio/_backends/_asyncio.py", line 1774, in wait
 await self._event.wait()
 File "/usr/local/lib/python3.13/asyncio/locks.py", line 213, in wait
 await fut
asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f6a851c0ec0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
 File "/venv/lib/python3.13/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
 yield
 File "/venv/lib/python3.13/site-packages/httpcore/_backends/anyio.py", line 113, in connect_tcp
 with anyio.fail_after(timeout):
 ~~~~~~~~~~~~~~~~^^^^^^^^^
 File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__
 self.gen.throw(value)
 ~~~~~~~~~~~~~~^^^^^^^
 File "/venv/lib/python3.13/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 "/venv/lib/python3.13/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
 yield
 File "/venv/lib/python3.13/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
 resp = await self._pool.handle_async_request(req)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
 raise exc
 File "/venv/lib/python3.13/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
 response = await connection.handle_async_request(request)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/httpcore/_async/connection.py", line 92, in handle_async_request
 raise exc
 File "/venv/lib/python3.13/site-packages/httpcore/_async/connection.py", line 69, in handle_async_request
 stream = await self._connect(request)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/httpcore/_async/connection.py", line 117, in _connect
 stream = await self._network_backend.connect_tcp(**kwargs)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
 return await self._backend.connect_tcp(
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ...<5 lines>...
 )
 ^
 File "/venv/lib/python3.13/site-packages/httpcore/_backends/anyio.py", line 112, in connect_tcp
 with map_exceptions(exc_map):
 ~~~~~~~~~~~~~~^^^^^^^^^
 File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__
 self.gen.throw(value)
 ~~~~~~~~~~~~~~^^^^^^^
 File "/venv/lib/python3.13/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
 raise to_exc(exc) from exc
httpcore.ConnectTimeout
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
 File "/venv/lib/python3.13/site-packages/slidge/core/dispatcher/util.py", line 157, in wrapped
 await cb(*args)
 File "/venv/lib/python3.13/site-packages/slidge/core/dispatcher/presence.py", line 136, in on_presence
 contact = await session.contacts.by_jid(pto)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/matteridge/contact.py", line 281, in by_jid
 await c.fetch_status()
 File "/venv/lib/python3.13/site-packages/matteridge/contact.py", line 124, in fetch_status
 if not await self.fetch_api_status():
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/matteridge/contact.py", line 151, in fetch_api_status
 status = await self.mm.get_user_status(mm_id)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/matteridge/api.py", line 613, in wrapped
 resp = await call_with_args_or_json_body(func, client, use_json_body, *a, **k)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/matteridge/api.py", line 601, in call_with_args_or_json_body
 resp = await func(*a, **k, client=client)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/mattermost_api_reference_client/api/status/get_user_status.py", line 142, in asyncio_detailed
 response = await client.get_async_httpx_client().request(**kwargs)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/httpx/_client.py", line 1530, in request
 return await self.send(request, auth=auth, follow_redirects=follow_redirects)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/httpx/_client.py", line 1617, in send
 response = await self._send_handling_auth(
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ...<4 lines>...
 )
 ^
 File "/venv/lib/python3.13/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
 response = await self._send_handling_redirects(
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ...<3 lines>...
 )
 ^
 File "/venv/lib/python3.13/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
 response = await self._send_single_request(request)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/httpx/_client.py", line 1719, in _send_single_request
 response = await transport.handle_async_request(request)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.13/site-packages/httpx/_transports/default.py", line 352, in handle_async_request
 with map_httpcore_exceptions():
 ~~~~~~~~~~~~~~~~~~~~~~~^^
 File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__
 self.gen.throw(value)
 ~~~~~~~~~~~~~~^^^^^^^
 File "/venv/lib/python3.13/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
 raise mapped_exc(message) from exc
httpx.ConnectTimeout
Probably some temporary server failures that we should handle without polluting the logs with this massive trace. ``` ERROR:slidge.core.dispatcher.util:Failed to handle incoming stanza: (<slidge.core.dispatcher.session_dispatcher.SessionDispatcher object at 0x7f6a864dc050>, <presence to="<redacted>@mattermost.slidge.im" from="nicoco@slidge.im/Cheogram.0gFH" xml:lang="en"><c xmlns="http://jabber.org/protocol/caps" ver="hAx0qhppW5/ZjrpXmbXW0F2SJVM=" node="https://cheogram.com" hash="sha-1" /><x xmlns="vcard-temp:x:update"><photo>5cddf9baa11eccc64518a2bc84ca3003a9945603</photo></x></presence>) Traceback (most recent call last): File "/venv/lib/python3.13/site-packages/anyio/_core/_tasks.py", line 115, in fail_after yield cancel_scope File "/venv/lib/python3.13/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp stream: anyio.abc.ByteStream = await anyio.connect_tcp( ^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... ) ^ File "/venv/lib/python3.13/site-packages/anyio/_core/_sockets.py", line 228, in connect_tcp async with create_task_group() as tg: ~~~~~~~~~~~~~~~~~^^ File "/venv/lib/python3.13/site-packages/anyio/_backends/_asyncio.py", line 776, in __aexit__ raise exc_val File "/venv/lib/python3.13/site-packages/anyio/_core/_sockets.py", line 233, in connect_tcp await event.wait() File "/venv/lib/python3.13/site-packages/anyio/_backends/_asyncio.py", line 1774, in wait await self._event.wait() File "/usr/local/lib/python3.13/asyncio/locks.py", line 213, in wait await fut asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f6a851c0ec0 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/venv/lib/python3.13/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions yield File "/venv/lib/python3.13/site-packages/httpcore/_backends/anyio.py", line 113, in connect_tcp with anyio.fail_after(timeout): ~~~~~~~~~~~~~~~~^^^^^^^^^ File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__ self.gen.throw(value) ~~~~~~~~~~~~~~^^^^^^^ File "/venv/lib/python3.13/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 "/venv/lib/python3.13/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions yield File "/venv/lib/python3.13/site-packages/httpx/_transports/default.py", line 353, in handle_async_request resp = await self._pool.handle_async_request(req) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request raise exc File "/venv/lib/python3.13/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request response = await connection.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/httpcore/_async/connection.py", line 92, in handle_async_request raise exc File "/venv/lib/python3.13/site-packages/httpcore/_async/connection.py", line 69, in handle_async_request stream = await self._connect(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/httpcore/_async/connection.py", line 117, in _connect stream = await self._network_backend.connect_tcp(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp return await self._backend.connect_tcp( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "/venv/lib/python3.13/site-packages/httpcore/_backends/anyio.py", line 112, in connect_tcp with map_exceptions(exc_map): ~~~~~~~~~~~~~~^^^^^^^^^ File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__ self.gen.throw(value) ~~~~~~~~~~~~~~^^^^^^^ File "/venv/lib/python3.13/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ConnectTimeout The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/venv/lib/python3.13/site-packages/slidge/core/dispatcher/util.py", line 157, in wrapped await cb(*args) File "/venv/lib/python3.13/site-packages/slidge/core/dispatcher/presence.py", line 136, in on_presence contact = await session.contacts.by_jid(pto) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/matteridge/contact.py", line 281, in by_jid await c.fetch_status() File "/venv/lib/python3.13/site-packages/matteridge/contact.py", line 124, in fetch_status if not await self.fetch_api_status(): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/matteridge/contact.py", line 151, in fetch_api_status status = await self.mm.get_user_status(mm_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/matteridge/api.py", line 613, in wrapped resp = await call_with_args_or_json_body(func, client, use_json_body, *a, **k) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/matteridge/api.py", line 601, in call_with_args_or_json_body resp = await func(*a, **k, client=client) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/mattermost_api_reference_client/api/status/get_user_status.py", line 142, in asyncio_detailed response = await client.get_async_httpx_client().request(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/httpx/_client.py", line 1530, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/httpx/_client.py", line 1617, in send response = await self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<4 lines>... ) ^ File "/venv/lib/python3.13/site-packages/httpx/_client.py", line 1645, in _send_handling_auth response = await self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... ) ^ File "/venv/lib/python3.13/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects response = await self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/httpx/_client.py", line 1719, in _send_single_request response = await transport.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.13/site-packages/httpx/_transports/default.py", line 352, in handle_async_request with map_httpcore_exceptions(): ~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__ self.gen.throw(value) ~~~~~~~~~~~~~~^^^^^^^ File "/venv/lib/python3.13/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectTimeout ```

I think that's absolutely okay for a logging with trace level

I think that's absolutely okay for a logging with trace level
Author
Owner
Copy link

Yeah but that happens at the ERROR level, so basically always. I have to catch it somewhere, it happens very often with the mattermost instance I use.

Yeah but that happens at the ERROR level, so basically always. I have to catch it somewhere, it happens very often with the mattermost instance I use.
Sign in to join this conversation.
No Branch/Tag specified
main
token-expiry-investigation
ci-container
container-latest
v0.4.0
v0.3.2
v0.3.1
v0.3.0
v0.2.3
v0.2.2
v0.2.1
v0.2.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
slidge/matteridge#8
Reference in a new issue
slidge/matteridge
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?