Bug #67564 [Com]: mysqli::ping mysqlnd_ms return Out of sync error

From: Date: Fri, 04 Jul 2014 05:09:55 +0000
Subject: Bug #67564 [Com]: mysqli::ping mysqlnd_ms return Out of sync error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186459@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67564&edit=1 ID: 67564 Comment by: accounts at dotmanila dot com Reported by: accounts at dotmanila dot com Summary: mysqli::ping mysqlnd_ms return Out of sync error Status: Open Type: Bug Package: MySQLi related Operating System: CentOS 6.5 PHP Version: 5.4.30 Block user comment: N Private report: N New Comment: I'd suspect the out of sync error means the actual connection to the server has not been established yet because mysqlnd_ms by default is lazy, to adhere more to the transparency feature of the plugin. One would have to execute something like below to actually create the connection: $mysqli->query('/*ms=master*/select 1'); $mysql->real_connect() at least should create the actual connection this as documented. Previous Comments: ------------------------------------------------------------------------ [2014-07-04 03:38:10] accounts at dotmanila dot com Description: ------------ When using mysqlnd_ms after creating a new mysqli object and executing a ping, an error is returned like: Connection to host 'primary' failed: [0] Commands out of sync; you can't run this command now If mysqlnd_ms is disabled, this works well without errors. mysqlnd => enabled Version => mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $ Compression => supported SSL => supported Command buffer size => 4096 Read buffer size => 32768 Read timeout => 31536000 Collecting statistics => Yes Collecting memory statistics => No Tracing => n/a Loaded plugins => mysqlnd,example,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password API Extensions => mysql,mysqli,pdo_mysql Test script: --------------- When using mysqlnd_ms: ---------------------- -- INI file: mysqlnd_ms.enable=1 mysqlnd_ms.force_config_usage = 1 mysqlnd_ms.config_file=mysqlnd_ms_ms.ini -- mysqlnd_ms_ms.ini { "primary": { "master": { "master_1": { "host": "127.0.0.1", "port": "33001" } }, "slave": { "slave_0": { "host": "127.0.0.1", "port": "33002" } } } } <?php $mysql_host = 'primary'; $mysqli = new mysqli($mysql_host, "msandbox", "msandbox", "test"); $t = $mysqli->ping(); if(!$t) { printf("Connection to host '{$mysql_host}' failed: [%d] %s, retrying ($retries of 10) in 3 seconds\n", $mysqli->connect_errno, $mysqli->error ); } ?> When using mysqlnd only: ---------------------- <?php $mysql_host = '127.0.0.1:33001'; $mysqli = new mysqli($mysql_host, "msandbox", "msandbox", "test"); $t = $mysqli->ping(); if(!$t) { printf("Connection to host '{$mysql_host}' failed: [%d] %s, retrying ($retries of 10) in 3 seconds\n", $mysqli->connect_errno, $mysqli->error ); } ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67564&edit=1

« previous php.bugs (#186459) next »