Uploaded image for project: 'MariaDB Connector/Python'
  1. MariaDB Connector/Python
  2. CONPY-316

mariadb.InterfaceError when using execute_many

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 1.1.7, 1.1.8, 1.1.9, 1.1.10, 1.1.11, 1.1.12
    • None
    • None
    • Executed in a docker container python, image: python:3.12
    • 3.12

    Description

      See below for more informations (Traceback, version)

      Summary

      I'm encountering a weird and hard-to-reproduce bug using execute_many() from the official MariaDB Python connector. Under very specific conditions, the method raises a mariadb.InterfaceError with no clear explanation.

      The issue is data-sensitive: only certain inputs trigger it. No SQL or data syntax error is reported — just a crash deep in the driver's internal _execute_bulk() method.

      Minimal reproducible example

      This is the exact query and data shape I'm sending:

      query = "UPDATE point SET building_density = ? WHERE id_point = ?"
      updates = [(0.25555, i) for i in range(225051, 225631)]
      cursor.executemany(query, updates)  # Crashes here with InterfaceError
      

      However, very similar calls do not crash:

      [(0, i) for i in range(225051, 225631)]        # Works
      [(0.25555, i) for i in range(225051, 225632)]  # Works
      [(0.25555, i) for i in range(225052, 225632)]  # Works
      

      Workaround found

      If I split the updates into smaller chunks, the error disappears completely:

      for chunk in [updates[i:i+100] for i in range(0, len(updates), 100)]:
          cursor.executemany(query, chunk)  # All chunks run fine
      

      Also, using .execute() in a loop works perfectly on the same data.
      The bug does not depend on the total byte size (~14 KB), nor on the number of rows (580).

      Changing float precision, ID ranges, or order of updates doesn't help — it appears to be an edge case of executemany()'s bulk handling.

      I have tried installing different versions of the MariaDB connector (from 1.1.7 to 1.1.12), but the issue persists.

      What I need

      Confirmation that this is a bug in the MariaDB driver.

      Possibly a fix or a way to disable BULK_OPERATIONS and fallback to safe mode.

      Or a documented explanation of what conditions can break executemany() like this.

      Thanks in advance!

      Traceback

      Traceback (most recent call last):
      File "/myfolder/database.py", line 43, in execute_many
      self.cursor.executemany(query, params_list)
      File "/usr/local/lib/python3.12/site-packages/mariadb/cursors.py", line 359, in executemany
      self._execute_bulk()
      mariadb.InterfaceError

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
      File "/myfolder/database.py", line 50, in execute_many
      self.conn.rollback()
      File "/usr/local/lib/python3.12/site-packages/mariadb/connections.py", line 192, in rollback
      self._read_response()
      mariadb.InterfaceError

      Versions

      Component Version
      MariaDB Python Connector mariadb==1.1.12
      MariaDB Server 11.4.7-MariaDB-ubu2404
      Python 3.12

      Database table schema:

      id_point INT(11) PRIMARY KEY AUTO_INCREMENT,
      building_density FLOAT
      

      Attachments

        Activity

          People

            georg Georg Richter
            krucksydev Plumey Simon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.