MatrixSynapse/synapse
Eric Eastwood 187ab28611 Messy: Fix undefined state_group for federated historical events
```
2021-07-13 02:27:57,810 - synapse.handlers.federation - 1248 - ERROR - GET-4 - Failed to backfill from hs1 because NOT NULL constraint failed: event_to_state_groups.state_group
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 1216, in try_backfill
    await self.backfill(
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 1035, in backfill
    await self._auth_and_persist_event(dest, event, context, backfilled=True)
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 2222, in _auth_and_persist_event
    await self._run_push_actions_and_persist_event(event, context, backfilled)
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 2244, in _run_push_actions_and_persist_event
    await self.persist_events_and_notify(
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 3290, in persist_events_and_notify
    events, max_stream_token = await self.storage.persistence.persist_events(
  File "/usr/local/lib/python3.8/site-packages/synapse/logging/opentracing.py", line 774, in _trace_inner
    return await func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/persist_events.py", line 320, in persist_events
    ret_vals = await yieldable_gather_results(enqueue, partitioned.items())
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/persist_events.py", line 237, in handle_queue_loop
    ret = await self._per_item_callback(
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/persist_events.py", line 577, in _persist_event_batch
    await self.persist_events_store._persist_events_and_state_updates(
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/databases/main/events.py", line 176, in _persist_events_and_state_updates
    await self.db_pool.runInteraction(
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 681, in runInteraction
    result = await self.runWithConnection(
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 770, in runWithConnection
    return await make_deferred_yieldable(
  File "/usr/local/lib/python3.8/site-packages/twisted/python/threadpool.py", line 238, in inContext
    result = inContext.theWork()  # type: ignore[attr-defined]
  File "/usr/local/lib/python3.8/site-packages/twisted/python/threadpool.py", line 254, in <lambda>
    inContext.theWork = lambda: context.call(  # type: ignore[attr-defined]
  File "/usr/local/lib/python3.8/site-packages/twisted/python/context.py", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/local/lib/python3.8/site-packages/twisted/python/context.py", line 83, in callWithContext
    return func(*args, **kw)
  File "/usr/local/lib/python3.8/site-packages/twisted/enterprise/adbapi.py", line 293, in _runWithConnection
    compat.reraise(excValue, excTraceback)
  File "/usr/local/lib/python3.8/site-packages/twisted/python/deprecate.py", line 298, in deprecatedFunction
    return function(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/twisted/python/compat.py", line 403, in reraise
    raise exception.with_traceback(traceback)
  File "/usr/local/lib/python3.8/site-packages/twisted/enterprise/adbapi.py", line 284, in _runWithConnection
    result = func(conn, *args, **kw)
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 765, in inner_func
    return func(db_conn, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 549, in new_transaction
    r = func(cursor, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/synapse/logging/utils.py", line 69, in wrapped
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/databases/main/events.py", line 385, in _persist_events_txn
    self._store_event_state_mappings_txn(txn, events_and_contexts)
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/databases/main/events.py", line 2065, in _store_event_state_mappings_txn
    self.db_pool.simple_insert_many_txn(
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 923, in simple_insert_many_txn
    txn.execute_batch(sql, vals)
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 280, in execute_batch
    self.executemany(sql, args)
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 300, in executemany
    self._do_execute(self.txn.executemany, sql, *args)
  File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 330, in _do_execute
    return func(sql, *args)
sqlite3.IntegrityError: NOT NULL constraint failed: event_to_state_groups.state_group
```
2021-07-20 19:56:44 -05:00
..
_scripts Add script for getting info about recently registered users (#10290) 2021-07-06 13:03:16 +01:00
api Add unstable room version to support new historical PL 2021-07-20 01:41:44 -05:00
app Add support for evicting cache entries based on last access time. (#10205) 2021-07-05 16:32:12 +01:00
appservice Implement knock feature (#6739) 2021-06-09 19:39:51 +01:00
config Remove functionality associated with unused historical stats tables (#9721) 2021-07-08 16:57:13 +01:00
crypto When joining a remote room limit the number of events we concurrently check signatures/hashes for (#10117) 2021-06-08 11:07:46 +01:00
events Add unstable room version to support new historical PL 2021-07-20 01:41:44 -05:00
federation Add type hints to get_domain_from_id and get_localpart_from_id. (#10385) 2021-07-13 12:08:47 -04:00
groups Rewrite the KeyRing (#10035) 2021-06-02 16:37:59 +01:00
handlers Messy: Fix undefined state_group for federated historical events 2021-07-20 19:56:44 -05:00
http Add additional types to the federation transport server. (#10213) 2021-06-28 07:36:41 -04:00
logging Expose opentracing trace id in response headers (#10199) 2021-06-18 11:43:22 +01:00
metrics opentracing: use a consistent name for background processes (#10135) 2021-06-07 17:57:49 +01:00
module_api MSC2918 Refresh tokens implementation (#9450) 2021-06-24 14:33:20 +01:00
push Move methods involving event authentication to EventAuthHandler. (#10268) 2021-07-01 14:25:37 -04:00
replication MSC2918 Refresh tokens implementation (#9450) 2021-06-24 14:33:20 +01:00
res/templates Port "Allow users to click account renewal links multiple times without hitting an 'Invalid Token' page #74" from synapse-dinsic (#9832) 2021-04-19 19:16:34 +01:00
rest Switch to chunk events so we can auth via power_levels 2021-07-20 00:06:31 -05:00
server_notices Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
spam_checker_api Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
state Messy: Fix undefined state_group for federated historical events 2021-07-20 19:56:44 -05:00
static Add initial support for a "pick your IdP" page (#9017) 2021-01-05 11:25:28 +00:00
storage Messy: Fix undefined state_group for federated historical events 2021-07-20 19:56:44 -05:00
streams Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
util Add support for evicting cache entries based on last access time. (#10205) 2021-07-05 16:32:12 +01:00
__init__.py 1.38.0 2021-07-13 13:19:06 +01:00
event_auth.py Add unstable room version to support new historical PL 2021-07-20 01:41:44 -05:00
notifier.py Improve opentracing annotations for Notifier (#10111) 2021-06-03 16:01:30 +01:00
python_dependencies.py Remove support for ACME v1 (#10194) 2021-06-17 18:56:48 +01:00
server.py Standardise the module interface (#10062) 2021-06-18 12:15:52 +01:00
types.py Add type hints to get_domain_from_id and get_localpart_from_id. (#10385) 2021-07-13 12:08:47 -04:00
visibility.py hs2 to better ask for insertion event extremity 2021-07-17 03:37:18 -05:00