Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got SQL error on second registration #1

Closed
ghost opened this issue Feb 8, 2021 · 1 comment
Closed

Got SQL error on second registration #1

ghost opened this issue Feb 8, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 8, 2021

ERROR:aioxmpp.callbacks:listener attached to signal raised
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context
    cursor, statement, parameters, context
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
    cursor.execute(statement, parameters)
sqlite3.IntegrityError: UNIQUE constraint failed: registration.jid

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/aioxmpp/callbacks.py", line 536, in fire
    keep = wrapper(args, kwargs)
  File "/usr/lib/python3.7/site-packages/aioxmpp/callbacks.py", line 470, in _strong_wrapper
    return not f(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/aioxmpp/dispatcher.py", line 287, in _feed
    super()._feed(stanza)
  File "/usr/lib/python3.7/site-packages/aioxmpp/dispatcher.py", line 135, in _feed
    cb(stanza)
  File "/usr/src/nina-xmpp/nina_xmpp/__init__.py", line 75, in message_received
    body[len(cmd) + 1:],
  File "/usr/src/nina-xmpp/nina_xmpp/__init__.py", line 186, in register
    self.db.commit()
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 1046, in commit
    self.transaction.commit()
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 504, in commit
    self._prepare_impl()
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 483, in _prepare_impl
    self.session.flush()
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2540, in flush
    self._flush(objects)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2682, in _flush
    transaction.rollback(_capture_exception=True)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    with_traceback=exc_tb,
  File "/usr/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2642, in _flush
    flush_context.execute()
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute
    rec.execute(self)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 589, in execute
    uow,
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 245, in save_obj
    insert,
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 1136, in _emit_insert_statements
    statement, params
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1011, in execute
    return meth(self, multiparams, params)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1130, in _execute_clauseelement
    distilled_params,
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1317, in _execute_context
    e, statement, parameters, cursor, context
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1511, in _handle_dbapi_exception
    sqlalchemy_exception, with_traceback=exc_info[2], from_=e
  File "/usr/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context
    cursor, statement, parameters, context
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) UNIQUE constraint failed: registration.jid
[SQL: INSERT INTO registration (jid, point) VALUES (?, GeomFromEWKT(?))]
[parameters: ('[email protected]', 'POINT (9.063090000000001 54.08809)')]
(Background on this error at: http://sqlalche.me/e/13/gkpj)
@jplitza
Copy link
Owner

jplitza commented Feb 9, 2021

Should be fixed by 1ed64e4. I didn't implement any migrations yet, so either you remove the UNIQUE index manually, or (better) re-initialize the database (which should now be much faster, thanks to 7a899e5)

@jplitza jplitza closed this as completed Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant