[MXS-3392] Reset implementation on failing prepared statement Created: 2021-02-01  Updated: 2021-03-04  Resolved: 2021-02-23

Status: Closed
Project: MariaDB MaxScale
Component/s: readwritesplit
Affects Version/s: 2.5.7
Fix Version/s: 2.4.17, 2.5.9

Type: Bug Priority: Major
Reporter: Diego Dupin Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: CONNECTOR_RELATED

Sprint: MXS-SPRINT-125

 Description   

There seems to be a strange behavior with maxscale when resetting a connection, after having a failed prepared statement.

#define check_mysql_rc(rc, mysql) \
do {\
  if (rc)\
  {\
    diag("Error (%d): %s (%d) in %s line %d", rc, mysql_error(mysql), \
         mysql_errno(mysql), __FILE__, __LINE__);\
    return(FAIL);\
  }\
} while(0)
 
  MYSQL_STMT *stmt= mysql_stmt_init(mysql);
  int rc;
  rc= mariadb_stmt_execute_direct(stmt, "SELECT 1 FROM nonexisting_table", -1);
  FAIL_IF(rc==0, "Expected error\n");
  rc = mysql_stmt_close(stmt);
  check_mysql_rc(rc, mysql);
  rc= mysql_reset_connection(mysql);
  check_mysql_rc(rc, mysql); => result in error

error is "Unknown prepared statement handler (4294967295) given to MaxScale (1243) "

4294967295 correspond to -1 => this is usually use by COM_STMT_EXECUTE to indicate to execute last prepared statement. mariadb_stmt_execute_direct might send a COM_STMT_CLOSE + COM_STMT_EXECUTE with id -1.

I don't understand what can cause this, because error occur on reset, but there is a strange behaviour with maxscale with this special "-1" feature.



 Comments   
Comment by markus makela [ 2021-02-01 ]

What version of MaxScale is this?

Comment by Diego Dupin [ 2021-02-01 ]

this is version 2.5.3

Comment by markus makela [ 2021-02-01 ]

Can you retest with the latest 2.5.7 release?

Comment by Diego Dupin [ 2021-02-01 ]

tested with 2.5.7 with exactly the same result

Generated at Thu Feb 08 04:21:05 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.