MariaDB "error closing cursor" every 30 seconds

HassOS 2018.8.8, MariaDB add-on 2.4.0.

I’ve seen the following error for at least a week or two now and have been ignoring it but decided to finally track it down. I enabled debug level logging on sqlalchemy.pool.impl.QueuePool.

Precisely every 30 seconds I will get the following message from one of the SyncWorkers. The worker seems to be different every time.

2021-08-25 17:52:42 DEBUG (SyncWorker_7) [sqlalchemy.pool.impl.QueuePool] Connection <_mysql.connection open to 'core-mariadb' at 0xfffface1d010> checked out from pool
2021-08-25 17:52:42 ERROR (SyncWorker_7) [sqlalchemy.pool.impl.QueuePool] Error closing cursor
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1865, in _safe_close_cursor
    cursor.close()
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 83, in close
    while self.nextset():
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 137, in nextset
    nr = db.next_result()
MySQLdb._exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 1' at line 1")
2021-08-25 17:52:42 DEBUG (SyncWorker_7) [sqlalchemy.pool.impl.QueuePool] Connection <_mysql.connection open to 'core-mariadb' at 0xfffface1d010> being returned to pool
2021-08-25 17:52:42 DEBUG (SyncWorker_7) [sqlalchemy.pool.impl.QueuePool] Connection <_mysql.connection open to 'core-mariadb' at 0xfffface1d010> rollback-on-return

I have only one sensor that uses an SQL query and 1) it works and 2) doesn’t use the string “LIMIT 1” in the query.

I’m not sure how to proceed with tracking down where this query is coming from.

Thanks,
-Jason