Looking for help with interpreting an error/debugging

426 views
Skip to first unread message

jens.t...@gmail.com

unread,
Mar 28, 2022, 6:58:02 AM3/28/22
to sqlalchemy
Hello,

I’m utterly stomped by this problem and I hope that the wisdom of the crowd (and the much more experienced users here) can point me into the right direction.

I’ve got a single MariaDB (Ver 15.1 Distrib 10.6.5-MariaDB, for Linux (x86_64)) running natively on a Linux host, and multiple containerized web servers (Pyramid) access that db through a mounted volume /var/run/mysqld/mysqld.sock. Pyramid uses the pyramid_tm package to manage its per-request transactions, and it uses SQLAlchemy v1.4.31 with the connect URL

sqlalchemy.url = mariadb+mariadbconnector://user:pwd@localhost/db?charset=utf8&binary_prefix=true&unix_socket=/var/run/mysqld/mysqld.sock

For two days now I’ve seen repeatedly the following errors for only one of the servers (oddly, one user of that server) while the other servers seem to operate just fine and continue talking to the db without problems.

Traceback (most recent call last):
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
    self.dialect.do_execute(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
    cursor.execute(statement, parameters)
mariadb.InterfaceError

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

Traceback (most recent call last):
  File "/.../venv/lib/python3.9/site-packages/waitress/channel.py", line 426, in service
    task.service()
  File "/.../venv/lib/python3.9/site-packages/waitress/task.py", line 168, in service
    self.execute()
  ...
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py", line 481, in __get__
    return self.impl.get(state, dict_)
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py", line 941, in get
    value = self._fire_loader_callables(state, key, passive)
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py", line 977, in _fire_loader_callables
    return self.callable_(state, passive)
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/orm/strategies.py", line 911, in _load_for_state
    return self._emit_lazyload(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/orm/strategies.py", line 1047, in _emit_lazyload
    result = session.execute(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1692, in execute
    result = conn._execute_20(statement, params or {}, execution_options)
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1614, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 325, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1481, in _execute_clauseelement
    ret = self._execute_context(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1845, in _execute_context
    self._handle_dbapi_exception(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2026, in _handle_dbapi_exception
    util.raise_(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
    raise exception
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
    self.dialect.do_execute(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.InterfaceError: (mariadb.InterfaceError)
[SQL: SELECT credits.id AS credits_id, credits.created AS credits_created, credits.expires AS credits_expires, credits.deleted AS credits_deleted, credits.user_id AS credits_user_id, credits.type AS credits_type, credits.unit_price AS credits_unit_price, credits.quantity AS credits_quantity, credits.count AS credits_count, credits.max_count AS credits_max_count, credits.stripe_invoice_id AS credits_stripe_invoice_id, credits.stripe_charge_id AS credits_stripe_charge_id, credits.stripe_refunded_charge_id AS credits_stripe_refunded_charge_id, credits.import_formats AS credits_import_formats, credits.export_formats AS credits_export_formats, credits.coupon_id AS credits_coupon_id
FROM credits
WHERE ? = credits.user_id ORDER BY -credits.created]
[parameters: ('bd87a54b6ca8404baeca03fc216f5e4e',)]
(Background on this error at: https://sqlalche.me/e/14/rvf5)


The other error I’m seeing scattered throughout is:

Traceback (most recent call last):
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
    self.dialect.do_execute(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
    cursor.execute(statement, parameters)
mariadb.OperationalError: Unknown MySQL error

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

Traceback (most recent call last):
  File "/.../venv/lib/python3.9/site-packages/waitress/channel.py", line 426, in service
    task.service()
  File "/.../venv/lib/python3.9/site-packages/waitress/task.py", line 168, in service
    self.execute()
  ...
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2810, in first
    return self.limit(1)._iter().first()
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2894, in _iter
    result = self.session.execute(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1692, in execute
    result = conn._execute_20(statement, params or {}, execution_options)
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1614, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 325, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1481, in _execute_clauseelement
    ret = self._execute_context(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1845, in _execute_context
    self._handle_dbapi_exception(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2026, in _handle_dbapi_exception
    util.raise_(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
    raise exception
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
    self.dialect.do_execute(
  File "/.../venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (mariadb.OperationalError) Unknown MySQL error
[SQL: SELECT auth_tokens.id AS auth_tokens_id, auth_tokens.api_token_nonce AS auth_tokens_api_token_nonce, auth_tokens.created AS auth_tokens_created, auth_tokens.expires AS auth_tokens_expires, auth_tokens.deleted AS auth_tokens_deleted, auth_tokens.user_id AS auth_tokens_user_id, auth_tokens.auth_profile_id AS auth_tokens_auth_profile_id
FROM auth_tokens
WHERE auth_tokens.id = ? AND auth_tokens.expires > ? AND auth_tokens.deleted IS NULL AND auth_tokens.api_token_nonce IS NULL
 LIMIT ?]
[parameters: ('f9dfa20e141d41178c0d6c475ee21368', datetime.datetime(2022, 3, 28, 9, 14, 22, 211131), 1)]
(Background on this error at: https://sqlalche.me/e/14/e3q8)


Suffice to say (as it often is) I didn’t change anything and the containers keep running and the host db hasn’t changed either. These errors started to raise and weirdly for one single user only while others continue to work without problems. Logging out/in and clearing auth tokens for that user didn’t help.

Any suggestions or recommendations you might have are more than welcome! I’m kind-of at my wits end right now… 🤔

Much thanks,
Jens

Mike Bayer

unread,
Mar 28, 2022, 8:35:56 AM3/28/22
to noreply-spamdigest via sqlalchemy
hey there -

never seen that before so it is very likely to be an issue specific to mariadbconnector, which is a much lesser-used driver.  suggestions are to seek help from mariadb connector devs directly, in the interim try mysqlclient or pymysql to see if the issue resolves, or shows a better error message.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.

jens.t...@gmail.com

unread,
Mar 28, 2022, 9:01:57 AM3/28/22
to sqlalchemy
Thank you Mike for your prompt response! I opened an issue CONPY-197, let’s see what comes of that.

I’ve used mysql+pymysql:// quite happily in the past with a MySQL db, and when we switched to MariaDB I switched the drivers. It didn’t occur to me that I could keep using the MySQL drivers, especially considering that MariaDB claims to be compatible… I’ll try that!

Jens

Mike Bayer

unread,
Mar 28, 2022, 9:10:26 AM3/28/22
to noreply-spamdigest via sqlalchemy
there's probably something up with that server so you will still get errors, but at least they will be familiar looking
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.

jens.t...@gmail.com

unread,
May 9, 2022, 7:15:47 AM5/9/22
to sqlalchemy
FWIW, after switching drivers I haven’t seen this issue again… (Please let’s not jinx it!)
Jens
Reply all
Reply to author
Forward
0 new messages