synapse/tests
Eric Eastwood c0b9437ab6
Fix lost logcontext when using timeout_deferred(...) (#19090)
Fix lost logcontext when using `timeout_deferred(...)` and things
actually timeout.

Fix https://github.com/element-hq/synapse/issues/19087 (our HTTP client
times out requests using `timeout_deferred(...)`
Fix https://github.com/element-hq/synapse/issues/19066 (`/sync` uses
`notifier.wait_for_events()` which uses `timeout_deferred(...)` under
the hood)


### When/why did these lost logcontext warnings start happening?

```
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
```

In https://github.com/element-hq/synapse/pull/18828, we switched
`timeout_deferred(...)` from using `reactor.callLater(...)` to
[`clock.call_later(...)`](3b59ac3b69/synapse/util/clock.py (L224-L313))
under the hood. This meant it started dealing with logcontexts but our
`time_it_out()` callback didn't follow our [Synapse logcontext
rules](3b59ac3b69/docs/log_contexts.md).
2025-10-30 11:49:15 -05:00
..
api Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
app Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
appservice Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
config Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
crypto Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
events Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
federation Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
handlers Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
http Move reading of multipart response into try body (#19062) 2025-10-30 15:22:52 +00:00
logging Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
media Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
metrics Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
module_api Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
push Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
replication Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
rest Remove logcontext problems caused by awaiting raw deferLater(...) (#19058) 2025-10-29 10:23:10 -05:00
scripts Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
server_notices Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
state Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
storage Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
synapse_rust Wrap the Rust HTTP client with make_deferred_yieldable (#18903) 2025-10-02 13:00:50 -05:00
test_utils Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
types Support for room version 12 2025-08-11 16:43:45 +01:00
util Fix lost logcontext when using timeout_deferred(...) (#19090) 2025-10-30 11:49:15 -05:00
__init__.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
server.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_distributor.py Cleanly shutdown SynapseHomeServer object (#18828) 2025-10-01 02:42:09 +00:00
test_event_auth.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_mau.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_phone_home.py Move unique snowflake homeserver background tasks to start_background_tasks (#19037) 2025-10-13 10:19:09 -05:00
test_rust.py Add missing type hints to tests. (#15027) 2023-02-08 19:52:37 +00:00
test_server.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_state.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_terms_auth.py Introduce Clock.call_when_running(...) to include logcontext by default (#18944) 2025-09-22 10:27:59 -05:00
test_types.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_visibility.py Introduce Clock.call_when_running(...) to include logcontext by default (#18944) 2025-09-22 10:27:59 -05:00
unittest.py Fix lost logcontext when using timeout_deferred(...) (#19090) 2025-10-30 11:49:15 -05:00
utils.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00