[CONC-236] <MYSQL_OPT_RECONNECT>, <mariadb_reconnect> and <CR_SERVER_LOST> Created: 2017-02-19  Updated: 2017-08-08  Resolved: 2017-08-08

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: 3.0.1
Fix Version/s: 2.3.2, 3.0.2

Type: Bug Priority: Major
Reporter: Ivan Kerentchev Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None
Environment:

Linux - MySQL Server 5.5.53
Windows 7 - MySQL Server 5.5.48



 Description   

<MYSQL_OPT_RECONNECT> is not working when the server is sending a CR_SERVER_LOST (error 2013). This happens when the 'low' wait-timeout on the server has been reached.

How to repeat:
-------------------

[mysqld]
wait-timeout = 30

MYSQL * m_MySql = mysql_init( NULL );
mysql_optionsv( m_MySql, MYSQL_OPT_RECONNECT, (void *)"1" );
m_MySql = mysql_real_connect
(
m_MySql,
Host,
User,
Pass,
Db,
Port,
NULL,
CLIENT_REMEMBER_OPTIONS
);
sleep(31); // 31 seconds
mysql_query( m_MySql, "SELECT 1;" );

The <mysql_query> fails since the wait_timeout on the MySQL-server has been exceeded,
and the server has closed the connection and sent error 2013.



 Comments   
Comment by Ivan Kerentchev [ 2017-08-08 ]

Since Release 3.0.2 this issue has been solved.
"mysql_reconnect which was used internally before (if the option MYSQL_OPT_RECONNECT was set) is now part of the API and can be used by applications and plugins to reestablish a failing Connection"

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