synapse/tests
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
..
api Use direct references for configuration variables (part 6). (#10916) 2021-09-29 06:44:15 -04:00
app Use direct references for configuration variables (part 4). (#10893) 2021-09-23 12:03:01 -04:00
appservice Fix errors in Synapse logs from unit tests. (#10939) 2021-09-30 11:03:29 -04:00
config Reset global cache state before cache tests. (#11036) 2021-10-12 12:55:33 +00:00
crypto Rewrite the KeyRing (#10035) 2021-06-02 16:37:59 +01:00
events Strip "join_authorised_via_users_server" from join events which do not need it. (#10933) 2021-10-01 11:39:17 -04:00
federation Fix errors in Synapse logs from unit tests. (#10939) 2021-09-30 11:03:29 -04:00
handlers Fix 500 error on /messages when we accumulate more than 5 backward extremities (#11027) 2021-10-14 18:53:45 -05:00
http Use direct references for configuration variables (part 6). (#10916) 2021-09-29 06:44:15 -04:00
logging Include exception in json logging (#11028) 2021-10-08 13:08:25 +02:00
module_api Fix errors in Synapse logs from unit tests. (#10939) 2021-09-30 11:03:29 -04:00
push Synapse 1.42.0rc1 (2021-09-01) 2021-09-01 14:58:14 +01:00
replication type-hint HomeserverTestcase.setup_test_homeserver (#10961) 2021-10-01 12:22:47 +01:00
rest Fix-up some type hints in the relations tests. (#11076) 2021-10-14 09:19:35 -04:00
scripts Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
server_notices Use direct references for configuration variables (part 6). (#10916) 2021-09-29 06:44:15 -04:00
state Update the MSC3083 support to verify if joins are from an authorized server. (#10254) 2021-07-26 12:17:00 -04:00
storage Stop user directory from failing if it encounters users not in the users table. (#11053) 2021-10-13 09:38:22 +00:00
test_utils Create a constant for a small png image in tests. (#10834) 2021-09-16 12:01:14 -04:00
util Use direct references for configuration variables (part 4). (#10893) 2021-09-23 12:03:01 -04:00
__init__.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
server.py Fix-up some type hints in the relations tests. (#11076) 2021-10-14 09:19:35 -04:00
test_distributor.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
test_event_auth.py Strip "join_authorised_via_users_server" from join events which do not need it. (#10933) 2021-10-01 11:39:17 -04:00
test_federation.py Inline _check_event_auth for outliers (#10926) 2021-09-28 15:25:07 +01:00
test_mau.py Add functionality to remove deactivated users from the monthly_active_users table (#10947) 2021-10-04 08:34:42 -07:00
test_metrics.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
test_phone_home.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
test_preview.py Ensure each charset is attempted only once during media preview. (#11089) 2021-10-14 18:51:44 +00:00
test_server.py Add reactor to SynapseRequest and fix up types. (#10868) 2021-09-24 11:01:25 +01:00
test_state.py Remove unnecessary parentheses around tuples returned from methods (#10889) 2021-09-23 11:59:07 +01:00
test_terms_auth.py Flatten the synapse.rest.client package (#10600) 2021-08-17 11:57:58 +00:00
test_test_utils.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
test_types.py [pyupgrade] tests/ (#10347) 2021-07-13 11:43:15 +01:00
test_visibility.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
unittest.py Fix-up some type hints in the relations tests. (#11076) 2021-10-14 09:19:35 -04:00
utils.py Remove unnecessary parentheses around tuples returned from methods (#10889) 2021-09-23 11:59:07 +01:00