php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67574 remember_failed Does Not Really work as Documented
Submitted: 2014-07-05 00:58 UTC Modified: 2017-10-24 04:27 UTC
From: accounts at dotmanila dot com Assigned:
Status: Suspended Package: mysqlnd_ms (PECL)
PHP Version: 5.4.30 OS: CentOS 6.5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: accounts at dotmanila dot com
New email:
PHP Version: OS:

 

 [2014-07-05 00:58 UTC] accounts at dotmanila dot com
Description:
------------
According to the documentation:

"""
If set to true the plugin will remember failed hosts and skip the hosts in all future load balancing made for the duration of the current web request.
"""

However this is not true, under the hood, for every script execution, a failed node is still being checked for.

Test script:
---------------
My test script is at 
https://github.com/dotmanila/demo-me/blob/master/phpugph201407/master-master.php

I'm using 3 node Percona XtraDB Cluster, for the sake of this testing and the script, it will work with 3 nodes as long as they are configured all as masters. See master-master.ini and mysqlnd_ms_mm.ini from https://github.com/dotmanila/demo-me/tree/master/phpugph201407

Run the script as:

strace -o out php -c master-master.ini master-master.php

Expected result:
----------------
The plugin should remember a node has failed and should retry only by some TTL.

Actual result:
--------------
An output of my test, roundrobin filter, 192.168.56.44 is a failed node (down), you can see the plugin still tries to connect to this node. If loop_before_master is not configured, an error will be thrown because the attempt to connect to this node will not be silently ignore anymore.

[revin@forge phpugph201407]$ cat out|grep 'connect('
connect(3, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.44")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(3, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.43")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.44")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.44")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.43")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(3, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.44")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(3, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.44")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(3, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.43")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.44")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(3, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.44")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(3, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.43")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.44")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(3, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.44")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(3, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.43")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.56.44")}, 16) = -1 EINPROGRESS (Operation now in progress)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-22 09:25 UTC] uw@php.net
I think, the documentation is correct. And, so is the implementation. Failed hosts are recalled for the duration of the life span of PHP. This can be as short as a single web request, depending on the PHP deployment model. The very next web request will try to use the failed host again. 

http://no2.php.net/manual/en/mysqlnd-ms.plugin-ini-json.php

"remember_failed 	

Remember failures for the duration of a web request. Default: false.

If set to true the plugin will remember failed hosts and skip the hosts in all future load balancing made for the duration of the current web request.

Since 1.4.0. The feature is only available together with the random and roundrobin load balancing filter. Use of the setting is recommended."

What's requested seems like a new feature.
 [2014-07-24 14:50 UTC] accounts at dotmanila dot com
Ulf, (if I guessed right :-))

With my test script, I tried to simulate a single web request within a loop by creating and destroying the mysqli object, but still within the same execution of the script. I was expecting that the failed node would've been remembered in this case, was my expectations wrong?
 [2017-10-24 04:27 UTC] kalle@php.net
-Status: Open +Status: Suspended
 [2017-10-24 04:27 UTC] kalle@php.net
I'm gonna suspend this report as the mysqlnd_ms had not a release since 2013 or active commit activity since then, if activity comes back to this package, it should be re-opened
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC