[ODBC-16] On the long run on single connection the connector increases number of open prepared statements Created: 2014-10-22  Updated: 2015-02-07  Resolved: 2015-02-07

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: None
Affects Version/s: 1.0.0
Fix Version/s: 1.0.0

Type: Bug Priority: Major
Reporter: Lawrin Novitsky Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: None

Attachments: File odbc16.diff    

 Description   

If you run something like
ODBC_TEST(test_multi_statements)
{
long num_inserted, i;
SQLRETURN rc;

for (i= 0; i < 100000; ++i)

{ OK_SIMPLE_STMT(Stmt, "DROP TABLE IF EXISTS t1"); OK_SIMPLE_STMT(Stmt, "CREATE TABLE t1 (a int)"); OK_SIMPLE_STMT(Stmt, "INSERT INTO t1 VALUES(1);INSERT INTO t1 VALUES(2)"); SQLRowCount(Stmt, &num_inserted); diag("inserted: %d(run #%d)", num_inserted, i); FAIL_IF(num_inserted != 1, "Expected 1 row inserted"); rc= SQLMoreResults(Stmt); num_inserted= 0; rc= SQLRowCount(Stmt, &num_inserted); FAIL_IF(num_inserted != 1, "Expected 1 row inserted"); rc= SQLMoreResults(Stmt); FAIL_IF(rc != SQL_NO_DATA, "expected no more results"); SQLFreeStmt(Stmt, SQL_CLOSE); }

return OK;
}
Application at some point will make server reach max_prepared_stmt_count, that will cause for sure error of application, and even a crash in some conditions.

The patch to fix the problem is in the attached odbc16.diff file



 Comments   
Comment by Lawrin Novitsky [ 2014-10-22 ]

The fix has been pushed as rev#41

Comment by Lawrin Novitsky [ 2014-11-11 ]

The testcase for the bug has been pushed as patch of rev#43, in revision #44 the important change for the original patch has been pushed

Comment by Lawrin Novitsky [ 2015-02-07 ]

Took pause and did not close the issue - was not sure that the fix covers all possible scenarios. But seems like it does the job well.

Generated at Thu Feb 08 03:25:37 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.