Bug #52561 [Com]: function mysqli_ping no attempted reconnection!

From: Date: Tue, 27 Nov 2018 09:22:14 +0000
Subject: Bug #52561 [Com]: function mysqli_ping no attempted reconnection!
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218154@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=52561&edit=1 ID: 52561 Comment by: qianqian dot bu at microsoft dot com Reported by: paulgao at yeah dot net Summary: function mysqli_ping no attempted reconnection! Status: Wont fix Type: Bug Package: MySQL related Operating System: irrelevant PHP Version: 5.3.3 Assigned To: mysql Block user comment: N Private report: N New Comment: May I ask if reconnection is not supported, what is the usage of the reconnect flag in MYSQLND_METHOD(mysqlnd_conn_data, connect)? May I ask a help that could you give me a use case for understanding? The code piece is something like below: if (GET_CONNECTION_STATE(&conn->state) > CONN_ALLOCED) { DBG_INF("Connecting on a connected handle."); if (GET_CONNECTION_STATE(&conn->state) < CONN_QUIT_SENT) { MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CLOSE_IMPLICIT); reconnect = TRUE; conn->m->send_close(conn); } Previous Comments: ------------------------------------------------------------------------ [2017-03-07 17:59:32] claudio dot galdiolo at gmail dot com Hi, the documentation of this function is not clear, I read these 3 statements: #1 Checks whether the connection to the server is working. If it has gone down and global option mysqli.reconnect is enabled, an automatic reconnection is attempted. #2 Note: The php.ini setting mysqli.reconnect is ignored by the mysqlnd driver, so automatic reconnection is never attempted. #3 This function can be used by clients that remain idle for a long while, to check whether the server has closed the connection and reconnect if necessary. Statement #1 says that "an automatic reconnection is attempted". Followed by statement #2 saying "automatic reconnection is never attempted". Followed by statement #3 saying "reconnect if necessary". http://php.net/manual/en/mysqli.ping.php ------------------------------------------------------------------------ [2014-10-16 16:39:09] andrey@php.net It is not implemented because reconnect creates a new connection which has new state and the state of the old connection is gone - session variables, transaction. In this context automatic reconnect is considered dangerous and is disabled since years in libmysql. mysqlnd doesn't provide this for the very same reason. ------------------------------------------------------------------------ [2014-09-26 23:40:07] jay at grooveshark dot com This caused problems for us trying to upgrade. Why is ping/reconnect considered dangerous? It has been working fine for us problem free for years. ------------------------------------------------------------------------ [2010-08-18 12:23:29] andrey@php.net You are using mysqlnd and it doesn't reconnect. It has no such capability by design. reconnect is off by default since ages and is considered dangerous. Thus, reconnect wasn't implemented in mysqlnd. Ergo, mysqli.reconnect has no meaning. You can either stay with libmysql, which however is not recommended in the long run. Or change your code so you reconnect explicitly. ------------------------------------------------------------------------ [2010-08-14 19:28:48] paulgao at yeah dot net when i use libmysql, sleep 31s+, mysqli_ping() is work, it can reconnection. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=52561 -- Edit this bug report at https://bugs.php.net/bug.php?id=52561&edit=1

« previous php.bugs (#218154) next »