Bug #77770 Python connector cannot connect to fabric XML RPC server on remote machine.
Submitted: 17 Jul 2015 19:54 Modified: 20 Mar 2017 11:41
Reporter: Sterling Cox Email Updates:
Status: Can't repeat Impact on me:
Category:Connector / Python Severity:S2 (Serious)
Version:2.0.4 OS:Any (same in OSX & Ubuntu 14.04LTS)
Assigned to: CPU Architecture:Any
Tags: Connection, error, fabric, host, python, rpc, XML

[17 Jul 2015 19:54] Sterling Cox
Unable to run simple tests against any remote Fabric server. The process at some point replaces the supplied host address with, which happens to work when the Fabric process is on localhost, but fails for all remote hosts. Using the enclosed ptest4.py this works when run on the fabric machine and fails from remote machines both Ubuntu 14.04 & OSX 10.10

How to repeat:
open the attached ptest4.py, from any host other than your fabric controller; 
set the following to suit your installation:
-hostname (l9)
-admin password (l12)
-fabric password (l16)
-group (l23)

run it & see it fail

open the same file in the fabric controller
set the hostname to either localhost,,, or the localhosts DNS name or hostname

run it & see it succeed.

*to see the error, edit your connection.py file (/Library/Python/2.7/site-packages/mysql/connector/connection.py in OSX, /usr/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py in Ubuntu) and add the following statement at line 335:

        print "connection.py request @335, host = ", host

& you can see the host become on the third call.

==============code for ptest4.py
import mysql.connector
from mysql.connector import fabric
from mysql.connector import errors
import time
import urllib

config = {
    'fabric': {
        'host': 'localhost',
        'port': 32274,
        'username': 'admin',
        'password': 'password',
        'report_errors': True
    'user': 'fabric',
    'password': 'password',
    'database': 'test',
    'autocommit': 'true'

fcnx = mysql.connector.connect(**config)
fcnx.set_property(group='g0', mode=fabric.MODE_READWRITE)
# print "creating the table if"
# cur = fcnx.cursor()
# cur.execute("create database if not exists test; create table if not exists test.test (id int unsigned not null auto_increment primary key) engine = innodb; insert into test.test values (null),(null),(null);")
print "starting loop"
while 1:
    if fcnx == None:
    	print "connect"
        fcnx = mysql.connector.connect(**config)
        fcnx.set_property(group='g0', mode=fabric.MODE_READWRITE)
    	print "run query"
        cur = fcnx.cursor()
        cur.execute("select now(), sleep(0.2) limit 10")
        for (id) in cur:
            print id
    	print "sleep 1 second"
    except errors.DatabaseError:
        print "sleep &  reconnecting"
        del fcnx
        fcnx = mysql.connector.connect(**config)
        fcnx.set_property(group='g0', mode=fabric.MODE_READWRITE)
            cur = fcnx.cursor()
            cur.execute("select 1")
        except errors.InterfaceError:
            fcnx = mysql.connector.connect(**config)
            fcnx.set_property(group='g0', mode=fabric.MODE_READWRITE)
[17 Jul 2015 20:22] Sterling Cox
Corrected Ubuntu version listed in original report.
[15 Sep 2015 21:27] Sterling Cox
Hi - it's been a while since this was filed, and it seem like something that would prevent anyone from using Fabric in a real environment. Is there anyone out there one might reach out to just for verification?
[11 Jan 2016 18:31] Joel Bradshaw
I can verify this behavior - we ran into this same issue in our (almost finished) implementation of Fabric in production.  For us, the Python connector was just for testing, we are actually using the PHP connector (which is a whole different ball of issues, but not under MySQL's purview), so it's not a blocking issue for us, but we did run into it when trying to test from outside localhost.

Issue seems to be the same as Sterling's: watching the output of a tcpdump, it seems to start accessing the Fabric server via the proper hostname, and then switch to attempting to access it via, which of course fails on anything other than the Fabric server itself.

I believe we've noticed this only happens if the listen address in the Fabric config is also - I can run some tests on my end and confirm that, it's been a while since I've dealt with this issue, since we just abandoned the Python connector once I got the PHP connector working sufficiently for testing.
[20 Mar 2017 11:41] Chiranjeevi Battula
Hello  Sterling,

Thank you for the bug report.
I could not repeat the issue at my end using with latest version of Connector / Python. 
If you can provide more information, feel free to add it to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.