Skip to content

Lost logcontext with antispam module #19087

@MadLittleMods

Description

@MadLittleMods

This issue is specifically tracking the possible logcontext problem, not the twisted.web._newclient.RequestGenerationFailed problem.

As experienced by @olmari and shared by @tulir in #synapse-dev:matrix.org

Logs

Relevant logs:

synapse.logging.context - 107 - WARNING - sentinel - Expected logging context call_later but found POST-2453

synapse.logging.context - 107 - WARNING - sentinel - Expected logging context call_later was lost

Full logs:

event_send_requests-2.log.2025-10-17-2025-10-17 23:56:37,070 - synapse_http_antispam - 75 - ERROR - POST-2453 - Error in async callback (POST http://localhost:29350/_meowlnir/antispam/!iCeEkVITYBNQSjgDxF:hacklab.fi/user_may_join_room)
event_send_requests-2.log.2025-10-17-Traceback (most recent call last):
event_send_requests-2.log.2025-10-17-  File "/opt/venvs/matrix-synapse/lib/python3.13/site-packages/synapse_http_antispam.py", line 73, in _catch_errors
event_send_requests-2.log.2025-10-17-    await task
event_send_requests-2.log.2025-10-17-  File "/opt/venvs/matrix-synapse/lib/python3.13/site-packages/synapse/http/client.py", line 564, in post_json_get_json
event_send_requests-2.log.2025-10-17-    response = await self.request(
event_send_requests-2.log.2025-10-17-               ^^^^^^^^^^^^^^^^^^^
event_send_requests-2.log.2025-10-17-        "POST", uri, headers=Headers(actual_headers), data=json_str
event_send_requests-2.log.2025-10-17-        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
event_send_requests-2.log.2025-10-17-    )
event_send_requests-2.log.2025-10-17-    ^
event_send_requests-2.log.2025-10-17-  File "/opt/venvs/matrix-synapse/lib/python3.13/site-packages/synapse/http/client.py", line 448, in request
event_send_requests-2.log.2025-10-17-    response = await make_deferred_yieldable(request_deferred)
event_send_requests-2.log.2025-10-17-               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
event_send_requests-2.log.2025-10-17-  File "/opt/venvs/matrix-synapse/lib/python3.13/site-packages/twisted/internet/defer.py", line 1187, in __iter__
event_send_requests-2.log.2025-10-17-    yield self
event_send_requests-2.log.2025-10-17-twisted.web._newclient.RequestGenerationFailed: [<twisted.python.failure.Failure twisted.internet.error.AlreadyCalled: Tried to cancel an already-called event.>]
event_send_requests-2.log.2025-10-17-2025-10-17 23:56:37,071 - synapse.logging.context - 107 - WARNING - sentinel - Expected logging context call_later but found POST-2453
event_send_requests-2.log.2025-10-17:2025-10-17 23:58:27,073 - synapse_http_antispam - 106 - ERROR - POST-2459 - Failed to connect to antispam server (POST http://localhost:29350/_meowlnir/antispam/!iCeEkVITYBNQSjgDxF:hacklab.fi/user_may_invite {'inviter': '@heisenbridge:hacklab.fi', 'invitee': '@irc_liberachat_guest54:hacklab.fi', 'room_id': '!bXWqpyKMwbfYIQWslT:hacklab.fi'})
event_send_requests-2.log.2025-10-17-Traceback (most recent call last):
event_send_requests-2.log.2025-10-17-  File "/opt/venvs/matrix-synapse/lib/python3.13/site-packages/synapse_http_antispam.py", line 84, in _do_request
event_send_requests-2.log.2025-10-17-    await task
event_send_requests-2.log.2025-10-17-  File "/opt/venvs/matrix-synapse/lib/python3.13/site-packages/synapse/http/client.py", line 564, in post_json_get_json
event_send_requests-2.log.2025-10-17-    response = await self.request(
event_send_requests-2.log.2025-10-17-               ^^^^^^^^^^^^^^^^^^^
event_send_requests-2.log.2025-10-17-        "POST", uri, headers=Headers(actual_headers), data=json_str
event_send_requests-2.log.2025-10-17-        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
event_send_requests-2.log.2025-10-17-    )
event_send_requests-2.log.2025-10-17-    ^
event_send_requests-2.log.2025-10-17-  File "/opt/venvs/matrix-synapse/lib/python3.13/site-packages/synapse/http/client.py", line 448, in request
event_send_requests-2.log.2025-10-17-    response = await make_deferred_yieldable(request_deferred)
event_send_requests-2.log.2025-10-17-               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
event_send_requests-2.log.2025-10-17-  File "/opt/venvs/matrix-synapse/lib/python3.13/site-packages/twisted/internet/defer.py", line 1187, in __iter__
event_send_requests-2.log.2025-10-17-    yield self
event_send_requests-2.log.2025-10-17-twisted.web._newclient.RequestGenerationFailed: [<twisted.python.failure.Failure twisted.internet.error.AlreadyCalled: Tried to cancel an already-called event.>]
event_send_requests-2.log.2025-10-17-2025-10-17 23:58:27,074 - synapse.logging.context - 107 - WARNING - sentinel - Expected logging context call_later was lost

Relevant code

As far as I can tell this is in the context of Meowlnir,

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions