Bug #73241 Unable to use a local python client against localhost fabric address
Submitted: 9 Jul 2014 10:56 Modified: 25 Sep 2014 16:25
Reporter: george sibley Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Fabric Severity:S3 (Non-critical)
Version:1.4.3 OS:Linux (ubuntu 3.11.0-18-generic)
Assigned to: Assigned Account CPU Architecture:Any

[9 Jul 2014 10:56] george sibley
Description:
I'm able to use a python connector client successfully when I have the 'protocol.xmlrpc' address set in the fabric fabric.cfg configuration file as follows:-

[protocol.xmlrpc]
address = localhost:32274

But when I change this to allow external clients (e.g. external java connector based clients), I get a '500' error from the python connector. This is the config that works successfully for external java connector clients:

[protocol.xmlrpc]
address = :32274

Have I hit a bug, or is there a configuration option I'm missing here?

I'm using python version '2.7.4'.

Here is the stacktrace from the python client:-

Traceback (most recent call last):
  File "read_fabric.py", line 7, in <module>
    autocommit=True
  File "/usr/lib/python2.7/dist-packages/mysql/connector/__init__.py", line 144, in connect
    return mysql.connector.fabric.connect(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mysql/connector/fabric/__init__.py", line 53, in connect
    return MySQLFabricConnection(**kwargs)
  File "/usr/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 809, in __init__
    self.store_config(**kwargs)
  File "/usr/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 948, in store_config
    self._configure_fabric(config['fabric'])
  File "/usr/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 929, in _configure_fabric
    self._fabric.seed()
  File "/usr/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 332, in seed
    fabinst.connect()
  File "/usr/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 763, in connect
    self._proxy = self._xmlrpc_get_proxy()
  File "/usr/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 747, in _xmlrpc_get_proxy
    proxy._some_nonexisting_method()  # pylint: disable=W0212
  File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 272, in request
    raise InterfaceError("Connection with Fabric failed: " + msg)
mysql.connector.errors.InterfaceError: Connection with Fabric failed: Service Unavailable (503)

How to repeat:
The client fails everytime.
[30 Jul 2014 13:18] Mats Kindahl
I am sorry, but it is a little unclear what you are trying to do. Could you please add a sample program that demonstrates what you are trying to do?

That section in the configuration file is used by mysqlfabric to connect to a Fabric server using HTTP. If you try to connect to that port using a normal connector, it will not work since connectors are expecting a MySQL Protocol at that endpoint and it looks like you're trying to connect to a HTTP server using the MySQL protocol.

The address can be used when configuring a Fabric-aware connector, but if you have a sample program it would help to see if there is a bug or not.
[25 Sep 2014 16:19] Alfranio Tavares Correia Junior
Hi George Sibley,

Thank you for the report.

The problem happens because the connector python accepts a seed
node as an input parameter and then fetches a list of Fabric nodes
(currently only one) from the seed node it connected to.

The information returned though is the following:

[DEBUG] 1411660572.553888 - XML-RPC-Session-0 - Encoded packet: [1, '5ca1ab1e-a007-feed-f00d-cab3fe13249e', 1, '', [{'info': {'names': ['host', 'port']}, 'rows': [('', 32274)]}]]

Note that the host is empty.

The connector python then uses this list blindly without checking whether
the host is empty or not and by consequence the connection fails:

  File "fabric-demo.py", line 132, in <module>
    exit(main())
  File "fabric-demo.py", line 128, in main
    client = Client(fabric_host, fabric_port, options.group, options.user, options.passwd)
  File "fabric-demo.py", line 34, in __init__
    self.__cnx = connect(**params)
  File "/usr/local/lib/python2.7/dist-packages/mysql/connector/__init__.py", line 143, in connect
    return fabric_connect(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/mysql/connector/fabric/__init__.py", line 60, in connect
    return MySQLFabricConnection(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 967, in __init__
    self.store_config(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 1106, in store_config
    self._configure_fabric(config['fabric'])
  File "/usr/local/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 1087, in _configure_fabric
    self._fabric.seed()
  File "/usr/local/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 457, in seed
    inst.connect()
  File "/usr/local/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 921, in connect
    self._proxy = self._xmlrpc_get_proxy()
  File "/usr/local/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 905, in _xmlrpc_get_proxy
    proxy._some_nonexisting_method()  # pylint: disable=W0212
  File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request
    verbose=self.__verbose
  File "/usr/local/lib/python2.7/dist-packages/mysql/connector/fabric/connection.py", line 368, in request
    raise InterfaceError("Connection with Fabric failed: " + msg)
mysql.connector.errors.InterfaceError: Connection with Fabric failed: <urlopen error [Errno -2] Name or service not known>
[25 Sep 2014 16:20] Alfranio Tavares Correia Junior
Please, set an address explicitly as workaround.

[protocol.xmlrpc]
address = address:32274

Cheers.
[6 Jul 2017 19:19] Bugs System
Status updated to 'Won't fix' (Fabric is now covered under Oracle Lifetime Sustaining Support)