Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Null value in column "membership" of relation "local_current_membership" violates not-null constraint #13301

Closed
TheNamelessWonderer opened this issue Jul 15, 2022 · 4 comments

Comments

@TheNamelessWonderer
Copy link

TheNamelessWonderer commented Jul 15, 2022

Description

Can't join the channel because of a previous account in database had a changed nickname.

Steps to reproduce

  • Change Nickname
  • Leave the room.
  • Delete from Database
  • Join again

Homeserver

Another HomeServer

Synapse Version

1.62.0

Installation Method

Docker (matrixdotorg/synapse)

Platform

Debian Linux
Container
i5-3450s 32GB Ram, SSD

Relevant log output

2022-07-15 21:44:50,446 - synapse.http.server - 183 - ERROR - POST-959727 - Failed handle request via 'JoinRoomAliasServlet': <XForwardedForRequest at 0x7fc9c8f1d640 method='POST' uri='/_matrix/client/r0/join/%23synapse%3Amatrix.org?server_name=matrix.org' clientproto='HTTP/1.0' site='8008'>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/synapse/http/server.py", line 366, in _async_render_wrapper
    callback_return = await self._async_render(request)
  File "/usr/local/lib/python3.9/site-packages/synapse/http/server.py", line 572, in _async_render
    callback_return = await raw_callback_return
  File "/usr/local/lib/python3.9/site-packages/synapse/rest/client/room.py", line 335, in on_POST
    await self.room_member_handler.update_membership(
  File "/usr/local/lib/python3.9/site-packages/synapse/handlers/room_member.py", line 510, in update_membership
    result = await self.update_membership_locked(
  File "/usr/local/lib/python3.9/site-packages/synapse/handlers/room_member.py", line 841, in update_membership_locked
    remote_join_response = await self._remote_join(
  File "/usr/local/lib/python3.9/site-packages/synapse/handlers/room_member.py", line 1593, in _remote_join
    event_id, stream_id = await self.federation_handler.do_invite_join(
  File "/usr/local/lib/python3.9/site-packages/synapse/handlers/federation.py", line 552, in do_invite_join
    max_stream_id = await self._federation_event_handler.process_remote_join(
  File "/usr/local/lib/python3.9/site-packages/synapse/handlers/federation_event.py", line 483, in process_remote_join
    stream_id_after_persist = await self.persist_events_and_notify(
  File "/usr/local/lib/python3.9/site-packages/synapse/handlers/federation_event.py", line 2014, in persist_events_and_notify
    ) = await self._storage_controllers.persistence.persist_events(
  File "/usr/local/lib/python3.9/site-packages/synapse/logging/opentracing.py", line 811, in _trace_inner
    return await func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/controllers/persist_events.py", line 331, in persist_events
    ret_vals = await yieldable_gather_results(enqueue, partitioned.items())
  File "/usr/local/lib/python3.9/site-packages/synapse/util/async_helpers.py", line 291, in yieldable_gather_results
    raise dfe.subFailure.value from None
  File "/usr/local/lib/python3.9/site-packages/twisted/internet/defer.py", line 1656, in _inlineCallbacks
    result = current_context.run(
  File "/usr/local/lib/python3.9/site-packages/twisted/python/failure.py", line 514, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/controllers/persist_events.py", line 327, in enqueue
    return await self._event_persist_queue.add_to_queue(
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/controllers/persist_events.py", line 201, in add_to_queue
    res = await make_deferred_yieldable(end_item.deferred.observe())
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/controllers/persist_events.py", line 244, in handle_queue_loop
    ret = await self._per_item_callback(
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/controllers/persist_events.py", line 633, in _persist_event_batch
    await self.persist_events_store._persist_events_and_state_updates(
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/databases/main/events.py", line 188, in _persist_events_and_state_updates
    await self.db_pool.runInteraction(
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/database.py", line 835, in runInteraction
    return await delay_cancellation(_runInteraction())
  File "/usr/local/lib/python3.9/site-packages/twisted/internet/defer.py", line 1656, in _inlineCallbacks
    result = current_context.run(
  File "/usr/local/lib/python3.9/site-packages/twisted/python/failure.py", line 514, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/database.py", line 807, in _runInteraction
    result = await self.runWithConnection(
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/database.py", line 930, in runWithConnection
    return await make_deferred_yieldable(
  File "/usr/local/lib/python3.9/site-packages/twisted/python/threadpool.py", line 244, in inContext
    result = inContext.theWork()  # type: ignore[attr-defined]
  File "/usr/local/lib/python3.9/site-packages/twisted/python/threadpool.py", line 260, in <lambda>
    inContext.theWork = lambda: context.call(  # type: ignore[attr-defined]
  File "/usr/local/lib/python3.9/site-packages/twisted/python/context.py", line 117, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/local/lib/python3.9/site-packages/twisted/python/context.py", line 82, in callWithContext
    return func(*args, **kw)
  File "/usr/local/lib/python3.9/site-packages/twisted/enterprise/adbapi.py", line 282, in _runWithConnection
    result = func(conn, *args, **kw)
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/database.py", line 923, in inner_func
    return func(db_conn, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/database.py", line 671, in new_transaction
    r = func(cursor, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/databases/main/events.py", line 433, in _persist_events_txn
    self._update_current_state_txn(txn, state_delta_for_room, min_stream_order)
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/databases/main/events.py", line 1127, in _update_current_state_txn
    txn.execute_batch(
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/database.py", line 329, in execute_batch
    self._do_execute(
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/database.py", line 395, in _do_execute
    return func(sql, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/database.py", line 330, in <lambda>
    lambda the_sql: execute_batch(self.txn, the_sql, args), sql
  File "/usr/local/lib/python3.9/site-packages/psycopg2/extras.py", line 1187, in execute_batch
    cur.execute(b";".join(sqls))
psycopg2.errors.NotNullViolation: null value in column "membership" of relation "local_current_membership" violates not-null constraint
DETAIL:  Failing row contains (!ehXvUhWNASUkSLvAGP:matrix.org, @link:example.org, $susI3ib1HMbcWnxUhbraFMu_S0MUB-EFVyjXT4buJCw, null).

Anything else that would be useful to know?

Not sure if the steps would work.

@TheNamelessWonderer
Copy link
Author

Waiting a bit seems to have solved the issue.

@richvdh
Copy link
Member

richvdh commented Jul 18, 2022

(I don't know what "delete from database" means, but if you're running SQL queries on your database then... yes that's going to break things. Don't.)

@TheNamelessWonderer
Copy link
Author

Delete the room from the database using the admin API. I am not running SQL commands.

@richvdh
Copy link
Member

richvdh commented Jul 18, 2022

oh right, in that case you were probably seeing #11521.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants