Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-2490

Unknown prepared statement handler (0) given to mysqld_stmt_execute

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.6
    • Fix Version/s: 2.3.9, 2.3.10
    • Component/s: readwritesplit
    • Environment:

      Description

      I made MariaDB Master-Slave cluster for Asterisk VoIP server. For balancing I use MaxScale with RWsplit strategy.

      Fragment of maxscale.cnf with splitter section:

      [splitter]
      type=service
      router=readwritesplit
      servers=dbmaster,dbslave
      user=maxscale
      password=
      connection_keepalive=120
      master_accept_reads=true
      

      Full maxscale.cnf attached.

      Got this error (maxscale.log) after connecting my Asterisk server to MaxScale:

      2019-05-14 13:33:25   warning: (9) Client requests unknown prepared statement ID '4294967295' that does not map to an internal ID
      2019-05-14 13:33:25   warning: (9) Using unknown prepared statement with ID 0
      

      I try to connect Astrerisk directly to Master and this works well - it can write and read, without any errors. What's why I think this is MaxScale issue.

      I get a traffic dump from my Asterisk server:

      After connecting, Asterisk send this SQL query:

      SELECT TABLE_SCHEMA AS TABLE_CAT, NULL AS TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, CASE DATA_TYPE WHEN 'bit' THEN @dt:= IF(NUMERIC_PRECISION=1,(-7), (-2)) WHEN 'tinyint' THEN @dt:=(-6) WHEN 'smallint' THEN @dt:=5 WHEN 'year' THEN @dt:= 5 WHEN 'mediumint' THEN @dt:=4 WHEN 'int' THEN @dt:=4 WHEN 'bigint' THEN @dt:=(-5) WHEN 'blob' THEN @dt:=(-4) WHEN 'tinyblob' THEN @dt:=(-4) WHEN 'mediumblob' THEN @dt:=(-4) WHEN 'longblob' THEN @dt:=(-4) WHEN 'decimal' THEN @dt:=3 WHEN 'float' THEN @dt:=IF(NUMERIC_SCALE IS NULL,7, 3) WHEN 'double' THEN @dt:=IF(NUMERIC_SCALE IS NULL,8, 3) WHEN 'binary' THEN @dt:=(-2) WHEN 'varbinary' THEN @dt:=(-3) WHEN 'text' THEN @dt:=(-1) WHEN 'tinytext' THEN @dt:=(-1) WHEN 'mediumtext' THEN @dt:=(-1) WHEN 'longtext' THEN @dt:=(-1) WHEN 'char' THEN @dt:=1 WHEN 'enum' THEN @dt:=1 WHEN 'set' THEN @dt:=1 WHEN 'varchar' THEN @dt:=12 WHEN 'date' THEN @dt:=91 WHEN 'time' THEN @dt:=92 WHEN 'datetime' THEN @dt:=93 WHEN 'timestamp' THEN @dt:=93 ELSE @dt:=(-4)END AS DATA_TYPE, UCASE(IF(COLUMN_TYPE LIKE '%(%)%', CONCAT(SUBSTRING(COLUMN_TYPE,1, LOCATE('(',COLUMN_TYPE) - 1 ), SUBSTRING(COLUMN_TYPE,1+locate(')',COLUMN_TYPE))), COLUMN_TYPE )) AS TYPE_NAME, CAST(CASE WHEN DATA_TYPE = 'bit' THEN @ColSize:=((NUMERIC_PRECISION + 7) / 8) WHEN DATA_TYPE in ('tinyint', 'smallint', 'mediumint', 'int','bigint', 'decimal') THEN @ColSize:=NUMERIC_PRECISION WHEN DATA_TYPE = 'float' THEN if(NUMERIC_SCALE IS NULL, @ColSize:=7, @ColSize:=NUMERIC_PRECISION) WHEN DATA_TYPE = 'double' THEN if(NUMERIC_SCALE IS NULL, @ColSize:=15, @ColSize:=NUMERIC_PRECISION) WHEN DATA_TYPE = 'date' THEN @ColSize:=10 WHEN DATA_TYPE = 'time' THEN @ColSize:=8 WHEN DATA_TYPE = 'year' THEN @ColSize:=4 WHEN DATA_TYPE in ('timestamp', 'datetime') THEN @ColSize:=19 ELSE @ColSize:=CHARACTER_MAXIMUM_LENGTH END AS UNSIGNED) AS COLUMN_SIZE,@tol:=CAST(CASE @dt WHEN (-7) THEN 1 WHEN (-6) THEN 1 WHEN 5 THEN 2 WHEN 4 THEN IF(DATA_TYPE='mediumint',3,4) WHEN (-5) THEN 20 WHEN 7 THEN 4 WHEN 6 THEN 8 WHEN 8 THEN 8 WHEN 9 THEN 6 WHEN 91 THEN 6 WHEN 10 THEN 6 WHEN 92 THEN 6 WHEN 11 THEN 16 WHEN 93 THEN 16 WHEN (-11) THEN 16 WHEN 3 THEN @ColSize + IF(COLUMN_TYPE LIKE '%unsigned',1,2) WHEN (-2) THEN IF(DATA_TYPE='bit', CAST(((NUMERIC_PRECISION + 7) / 8) AS SIGNED), CHARACTER_OCTET_LENGTH) WHEN (-3) THEN CHARACTER_OCTET_LENGTH WHEN (-4) THEN CHARACTER_OCTET_LENGTH ELSE CHARACTER_MAXIMUM_LENGTH*3 END AS SIGNED) AS BUFFER_LENGTH, NUMERIC_SCALE DECIMAL_DIGITS, IF(CHARACTER_OCTET_LENGTH IS NOT NULL, NULL, 10) AS NUM_PREC_RADIX,IF(DATA_TYPE='timestamp', 1, IF(IS_NULLABLE='YES',1,IF(EXTRA='auto_increment', 1, 0))) AS NULLABLE, COLUMN_COMMENT AS REMARKS,COLUMN_DEFAULT AS COLUMN_DEF,CAST(CASE WHEN DATA_TYPE = 'date' THEN 9 WHEN DATA_TYPE = 'time' THEN 9 WHEN DATA_TYPE = 'datetime' THEN 9 WHEN DATA_TYPE = 'timestamp' THEN 9 ELSE @dt END AS SIGNED) SQL_DATA_TYPE,CAST(CASE WHEN DATA_TYPE = 'date' THEN 1 WHEN DATA_TYPE = 'time' THEN 2 WHEN DATA_TYPE = 'datetime' THEN 3 WHEN DATA_TYPE = 'timestamp' THEN 3 ELSE NULL END AS SIGNED) SQL_DATETIME_SUB,IF(CHARACTER_OCTET_LENGTH IS NOT NULL, @tol, IF(DATA_TYPE='bit' AND NUMERIC_PRECISION =1, NULL, CAST((NUMERIC_PRECISION + 7)/8 AS SIGNED))) AS CHAR_OCTET_LENGTH, ORDINAL_POSITION,IF(DATA_TYPE='timestamp', 'YES', IF(IS_NULLABLE='YES','YES',IF(EXTRA='auto_increment', 'YES', 'NO'))) AS IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE()AND TABLE_NAME LIKE 'cdr' AND COLUMN_NAME LIKE '%' ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION
      

      And MaxScale answer with error 1243:

      Unknown prepared statement handler (0) given to mysqld_stmt_execute
      

      Found nothing relevant here, so will be glad if you can help to solve the issue. Once more, It works great with direct Astersik<odbc>Master connection, so issue is related to MaxScale.
      Ready to provide any additional info for diagnose and solve it.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                markus makela markus makela
                Reporter:
                omavel balyn
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: