synapse-product/tests/handlers
Eric Eastwood daf498e099
Fix 500 error on /messages when we accumulate more than 5 backward extremities (#11027)
Found while working on the Gitter backfill script and noticed
it only happened after we sent 7 batches, https://gitlab.com/gitterHQ/webapp/-/merge_requests/2229#note_665906390

When there are more than 5 backward extremities for a given depth,
backfill will throw an error because we sliced the extremity list
to 5 but then try to iterate over the full list. This causes
us to look for state that we never fetched and we get a `KeyError`.

Before when calling `/messages` when there are more than 5 backward extremities:
```
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/synapse/http/server.py", line 258, in _async_render_wrapper
    callback_return = await self._async_render(request)
  File "/usr/local/lib/python3.8/site-packages/synapse/http/server.py", line 446, in _async_render
    callback_return = await raw_callback_return
  File "/usr/local/lib/python3.8/site-packages/synapse/rest/client/room.py", line 580, in on_GET
    msgs = await self.pagination_handler.get_messages(
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/pagination.py", line 396, in get_messages
    await self.hs.get_federation_handler().maybe_backfill(
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 133, in maybe_backfill
    return await self._maybe_backfill_inner(room_id, current_depth, limit)
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 386, in _maybe_backfill_inner
    likely_extremeties_domains = get_domains_from_state(states[e_id])
KeyError: '$zpFflMEBtZdgcMQWTakaVItTLMjLFdKcRWUPHbbSZJl'
```
2021-10-14 18:53:45 -05:00
..
__init__.py Reference Matrix Home Server 2014-08-12 15:10:52 +01:00
oidc_test_key.p8 JWT OIDC secrets for Sign in with Apple (#9549) 2021-03-09 15:03:37 +00:00
oidc_test_key.pub.pem JWT OIDC secrets for Sign in with Apple (#9549) 2021-03-09 15:03:37 +00:00
test_admin.py Flatten the synapse.rest.client package (#10600) 2021-08-17 11:57:58 +00:00
test_appservice.py Only return an appservice protocol if it has a service providing it. (#10532) 2021-08-05 08:22:14 -04:00
test_auth.py Use direct references for configuration variables (part 4). (#10893) 2021-09-23 12:03:01 -04:00
test_cas.py Rename handler and config modules which end in handler/config. (#9816) 2021-04-20 14:55:20 -04:00
test_device.py MSC2918 Refresh tokens implementation (#9450) 2021-06-24 14:33:20 +01:00
test_directory.py Use direct references for configuration variables (part 5). (#10897) 2021-09-24 07:25:21 -04:00
test_e2e_keys.py Always communicate device OTK counts to clients (#10485) 2021-07-27 14:36:38 +01:00
test_e2e_room_keys.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
test_federation.py Fix 500 error on /messages when we accumulate more than 5 backward extremities (#11027) 2021-10-14 18:53:45 -05:00
test_message.py Flatten the synapse.rest.client package (#10600) 2021-08-17 11:57:58 +00:00
test_oidc.py Rename handler and config modules which end in handler/config. (#9816) 2021-04-20 14:55:20 -04:00
test_password_providers.py Port the Password Auth Providers module interface to the new generic interface (#10548) 2021-10-13 11:21:52 +00:00
test_presence.py Split FederationHandler in half (#10692) 2021-08-26 21:41:44 +01:00
test_profile.py Use direct references for configuration variables (part 7). (#10959) 2021-10-04 07:18:54 -04:00
test_receipts.py Add type hints for event streams. (#10856) 2021-09-21 13:34:26 -04:00
test_register.py Clean-up registration tests (#10945) 2021-09-30 14:06:02 -04:00
test_room_summary.py Ignore rooms with unknown room versions in the spaces summary. (#10727) 2021-09-01 17:01:08 +00:00
test_room.py Pull out encrypted_by_default tests from user_directory tests (#10752) 2021-09-06 11:37:54 +01:00
test_saml.py Use mock from the stdlib. (#9772) 2021-04-09 13:44:38 -04:00
test_send_email.py Fix incompatibility with Twisted < 21. (#10713) 2021-08-27 16:33:41 +01:00
test_stats.py Don't drop user dir deltas when server leaves room (#10982) 2021-10-06 12:56:45 +00:00
test_sync.py Do not include rooms with an unknown room version in a sync response. (#10644) 2021-08-19 11:12:55 -04:00
test_typing.py Add type hints for event streams. (#10856) 2021-09-21 13:34:26 -04:00
test_user_directory.py Stop user directory from failing if it encounters users not in the users table. (#11053) 2021-10-13 09:38:22 +00:00