DarkflameUniverse / NexusDashboard

Dashboard for Complete Management of a DLU game server
GNU Affero General Public License v3.0
47 stars 7 forks source link

bug: Soft crash on attempt to approve a duplicate name #103

Open HailStorm32 opened 1 month ago

HailStorm32 commented 1 month ago

(Full error at bottom of report)

Oct 18 00:36:27 nexus-universe gunicorn[81809]: sqlalchemy.exc.IntegrityError: (pymysql.err.IntegrityError) (1062, "Duplicate entry 'Zuzubell' for key 'name'")
Oct 18 00:36:27 nexus-universe gunicorn[81809]: [SQL: UPDATE charinfo SET name=%(name)s, pending_name=%(pending_name)s WHERE charinfo.id = %(charinfo_id)s AND charinfo.prop_clone_id = %(charinfo_prop_clone_id)s]
Oct 18 00:36:27 nexus-universe gunicorn[81809]: [parameters: {'name': 'Zuzubell', 'pending_name': '', 'charinfo_id': 12114, 'charinfo_prop_clone_id': 597}]

Full Error

Oct 18 00:36:27 nexus-universe gunicorn[81809]: [2024-10-18 00:36:27 +0000] [81809] [ERROR] Exception on /characters/approve_name/12114/approve [GET]
Oct 18 00:36:27 nexus-universe gunicorn[81809]: Traceback (most recent call last):
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     self.dialect.do_execute(
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     cursor.execute(statement, parameters)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/cursors.py", line 148, in execute
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     result = self._query(query)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:              ^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/cursors.py", line 310, in _query
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     conn.query(q)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/connections.py", line 548, in query
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     self._affected_rows = self._read_query_result(unbuffered=unbuffered)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/connections.py", line 775, in _read_query_result
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     result.read()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/connections.py", line 1156, in read
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     first_packet = self.connection._read_packet()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/connections.py", line 725, in _read_packet
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     packet.raise_for_error()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/protocol.py", line 221, in raise_for_error
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     err.raise_mysql_exception(self._data)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     raise errorclass(errno, errval)
Oct 18 00:36:27 nexus-universe gunicorn[81809]: pymysql.err.IntegrityError: (1062, "Duplicate entry 'Zuzubell' for key 'name'")
Oct 18 00:36:27 nexus-universe gunicorn[81809]: The above exception was the direct cause of the following exception:
Oct 18 00:36:27 nexus-universe gunicorn[81809]: Traceback (most recent call last):
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/flask/app.py", line 1455, in wsgi_app
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     response = self.full_dispatch_request()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/flask/app.py", line 869, in full_dispatch_request
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     rv = self.handle_user_exception(e)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/flask/app.py", line 867, in full_dispatch_request
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     rv = self.dispatch_request()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:          ^^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/flask/app.py", line 852, in dispatch_request
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/flask_user/decorators.py", line 58, in decorator
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     return view_function(*args, **kwargs)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/NexusDashboard/app/__init__.py", line 359, in wrapper
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     return func(*args, **kwargs)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:            ^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/NexusDashboard/app/characters.py", line 34, in approve_name
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     log_audit(f"Approved ({character.id}){character.pending_name} from {character.name}")
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/NexusDashboard/app/__init__.py", line 368, in log_audit
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     ).save()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:       ^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/NexusDashboard/app/models.py", line 1079, in save
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     db.session.commit()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/scoping.py", line 598, in commit
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     return self._proxied.commit()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:            ^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 1969, in commit
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     trans.commit(_to_root=True)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "<string>", line 2, in commit
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     ret_value = fn(self, *arg, **kw)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:                 ^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 1256, in commit
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     self._prepare_impl()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "<string>", line 2, in _prepare_impl
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     ret_value = fn(self, *arg, **kw)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:                 ^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 1231, in _prepare_impl
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     self.session.flush()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 4312, in flush
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     self._flush(objects)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 4447, in _flush
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     with util.safe_reraise():
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     raise exc_value.with_traceback(exc_tb)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 4408, in _flush
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     flush_context.execute()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     rec.execute(self)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     util.preloaded.orm_persistence.save_obj(
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/persistence.py", line 85, in save_obj
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     _emit_update_statements(
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/orm/persistence.py", line 909, in _emit_update_statements
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     c = connection.execute(
Oct 18 00:36:27 nexus-universe gunicorn[81809]:         ^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     return meth(
Oct 18 00:36:27 nexus-universe gunicorn[81809]:            ^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     return connection._execute_clauseelement(
Oct 18 00:36:27 nexus-universe gunicorn[81809]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     ret = self._execute_context(
Oct 18 00:36:27 nexus-universe gunicorn[81809]:           ^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     return self._exec_single_context(
Oct 18 00:36:27 nexus-universe gunicorn[81809]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     self._handle_dbapi_exception(
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2343, in _handle_dbapi_exception
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     self.dialect.do_execute(
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     cursor.execute(statement, parameters)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/cursors.py", line 148, in execute
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     result = self._query(query)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:              ^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/cursors.py", line 310, in _query
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     conn.query(q)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/connections.py", line 548, in query
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     self._affected_rows = self._read_query_result(unbuffered=unbuffered)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/connections.py", line 775, in _read_query_result
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     result.read()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/connections.py", line 1156, in read
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     first_packet = self.connection._read_packet()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/connections.py", line 725, in _read_packet
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     packet.raise_for_error()
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/protocol.py", line 221, in raise_for_error
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     err.raise_mysql_exception(self._data)
Oct 18 00:36:27 nexus-universe gunicorn[81809]:   File "/home/gameserver/.local/lib/python3.12/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
Oct 18 00:36:27 nexus-universe gunicorn[81809]:     raise errorclass(errno, errval)
Oct 18 00:36:27 nexus-universe gunicorn[81809]: sqlalchemy.exc.IntegrityError: (pymysql.err.IntegrityError) (1062, "Duplicate entry 'Zuzubell' for key 'name'")
Oct 18 00:36:27 nexus-universe gunicorn[81809]: [SQL: UPDATE charinfo SET name=%(name)s, pending_name=%(pending_name)s WHERE charinfo.id = %(charinfo_id)s AND charinfo.prop_clone_id = %(charinfo_prop_clone_id)s]
Oct 18 00:36:27 nexus-universe gunicorn[81809]: [parameters: {'name': 'Zuzubell', 'pending_name': '', 'charinfo_id': 12114, 'charinfo_prop_clone_id': 597}]
aronwk-aaron commented 1 month ago

skill, issue (will look into it, this probably needs some protection on DLU's side as well)