Long query gets stuck despite max_statement_time being set
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oursql |
New
|
Undecided
|
Unassigned |
Bug Description
I am on Ubuntu 18, using oursql 0.9.3.2, and /usr/lib/
I am using oursql to connect to 2 different servers: MariaDB 10.1.38 and MariaDB 10.3.15:
Expected behavior (MariaDB 10.1.38):
conn = oursql.
curs = conn.cursor()
curs.execute("SET SESSION max_statement_
curs.execute("SHOW variables like 'max_statement_%'")
curs.fetchall()
>> [(u'max_
curs.execute(
curs.fetchall()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "oursqlx/
File "oursqlx/
File "oursqlx/
oursql.
Unexpected behavior (MariaDB 10.3.15):
conn = oursql.
curs = conn.cursor()
curs.execute("SET SESSION max_statement_
curs.execute("SHOW variables like 'max_statement_%'")
curs.fetchall()
>> [(u'max_
curs.execute(
curs.fetchall()
... Gets stuck
I have 3 interesting observations:
- looking at 'processlist' on the server side confirms that the query was actually canceled (connection is in sleep mode)
- running the same sequence using the 'mysql' CLI of MariaDB 10.1.38 against the MariaDB 10.3.15 server works fine (query is interrupted).
- running the same sequence using libmysqlclient from C code works.
Any hints as to how to debug this will be highly appreciated.
Below is my C++ program that executes the same using libmysqlclient:
=======
#include <my_global.h>
#include <mysql.h>
#include <iostream>
using namespace std;
int finish_
{
cerr << mysql_error(con) << endl;
mysql_
return 1;
}
int main()
{
cout << "MySQL client version: " << mysql_get_
MYSQL *con = mysql_init(NULL);
if (con == NULL)
{
cerr << "mysqlinit() failed" << endl;
return 1;
}
if (mysql_
{
return finish_
}
if (mysql_query(con, "SET SESSION max_statement_
{
return finish_
}
if (mysql_query(con, "<long running query>"))
{
return finish_
}
MYSQL_RES *result = mysql_store_
if (result == NULL)
{
return finish_
}
mysql_
mysql_
return 0;
}
g++ -o test test.cpp $(mysql_config --cflags --libs)
./test
MySQL client version: 5.7.26
Query execution was interrupted (max_statement_time exceeded)
description: | updated |
description: | updated |
description: | updated |
description: | updated |