Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-771

InterfaceError raised when statement is 8192~ characters

    XMLWordPrintable

Details

    Description

      When using the python connector I'm getting an InterfaceError raised when the statement plus parameters are the same or slightly greater than the size of the socket buffer (8192).

      To reproduce:

      import mariadb
      for x in range(8125, 8140):
          connection = mariadb.connection(user='root', database = 'test')
          cursor = connection.cursor()
          cursor.execute("CREATE TABLE IF NOT EXISTS `testing` (`text` MEDIUMTEXT)")
          try:
              cursor.execute("INSERT INTO testing (`text`) VALUES (?)", (' ' * x, ))
          except Exception as e:
              print(f" Bad at {x}: {e!r} raised")
          else:
              print(f"Good at {x}")
      

      Which will emit:

      Good at 8125
      Good at 8126
      Good at 8127
      Good at 8128
      Good at 8129
      Good at 8130
       Bad at 8131: InterfaceError('') raised
       Bad at 8132: InterfaceError('') raised
       Bad at 8133: InterfaceError('') raised
       Bad at 8134: InterfaceError('') raised
      Good at 8135
      Good at 8136
      Good at 8137
      Good at 8138
      Good at 8139
      

      Following the code in `gdb` and we are returning an error here: https://github.com/mariadb-corporation/mariadb-connector-c/blob/461a2c79ea63406065a6237bf1043a250099565d/libmariadb/mariadb_lib.c#L527 in the c connector but I'm not sure if the bug is with that code or how the python connector is calling it.

      Attachments

        Issue Links

          Activity

            People

              georg Georg Richter
              callum.walker Callum Walker
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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