Edit report at http://bugs.php.net/bug.php?id=49511&edit=1
ID: 49511 Updated by: u...@php.net Reported by: casper at procurios dot nl Summary: mysqlnd timeout seems fixed at 60 secs Status: To be documented Type: Bug Package: MySQL related Operating System: * PHP Version: 5.3, 6 (2009-09-09) -Assigned To: +Assigned To: abedford Block user comment: N New Comment: Tony, can you take it? Thanks! Previous Comments: ------------------------------------------------------------------------ [2009-09-16 15:09:48] u...@php.net Regarding default_socket_timeout = -1 -> endless: I don't think it is an overflow. I only glimpsed over the code and saw that sometimes an extra check is made for -1 to convert it into NULL. And NULL means endless, see http://msdn.microsoft.com/en-us/library/ms740141%28VS.85%29.aspx or, same on Linux, man select. ------------------------------------------------------------------------ [2009-09-16 15:05:51] u...@php.net It should be fixed now, please test a SVN snapshot. We may want to stress out in the documentation that a) users cannot set MYSQL_OPT_READ_TIMEOUT through an API call and, if we ever allow setting it, there may be subtle differences between libmysql and streams how to interpret the value of MYSQL_OPT_READ_TIMEOUT. Using mysqlnd means using PHP streams. PHP streams documentation needs to be consulted on such details not dev.mysql.com documentation on the MySQL Client Library AKA libmysql AKA C-API. ------------------------------------------------------------------------ [2009-09-16 15:00:54] s...@php.net Automatic comment from SVN on behalf of uw Revision: http://svn.php.net/viewvc/?view=revision&revision=288378 Log: Fix and tests for bug #49511 . mysqlnd and the MySQL Client Library (libmysql) use different networking APIs. mysqlnd does use PHP streams whereas libmysql uses its own wrapper of the operating level network calls. PHP sets by default a read timeout of 60s for streams - php.ini, default_socket_timeout. This default applies to all streams that set no other timeout value. mysqlnd has not set any other value and therefore it connections of long running queries can have been cut off after default_socket_timeout seconds resulting in a 2006 - MySQL Server has gone away error message. The MySQL Client Library sets a default timeout of 365 * 24 * 3600 seconds (1year) and waits for other timeouts to happen, e.g. TCP/IP timeouts. mysqlnd now uses the same very long timeout. The value is configurable through a new php.ini setting: mysqlnd.net_read_timeout. mysqlnd.net_read_timeout gets used by any extension (ext/mysql, ext/mysqli, PDO_MySQL) that uses mysqlnd. mysqlnd tells PHP Streams to use mysqlnd.net_read_timeout. Please note that there may be subtle differences between MYSQL_OPT_READ_TIMEOUT from the MySQL Client Library and PHP Streams. E.g. MYSQL_OPT_READ_TIMEOUT is documented to work only for TCP/IP connections and, prior to MySQL 5.1.2, only for Windows. PHP streams may not have this limitation. Please check the streams documentation, if in doubt. ------------------------------------------------------------------------ [2009-09-16 13:43:06] u...@php.net For the public and on "libmysql not compatible": Pierre and I had an argue on IRC. While we still disagree in some points we concluded it would be benefitial to document some background information for users - either in the docs or on the wiki. On the bug itself: I am waiting for Andrey to review a patch. ------------------------------------------------------------------------ [2009-09-16 12:13:45] u...@php.net Any bug reports on libmysql crashes we could work on? ------------------------------------------------------------------------ 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 http://bugs.php.net/bug.php?id=49511 -- Edit this bug report at http://bugs.php.net/bug.php?id=49511&edit=1