Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-79

schemarouter hangs if client connects with empty database

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.1.0
    • Component/s: schemarouter
    • Labels:
      None
    • Environment:
      CentOS 6

      Description

      Apparently Oracle Connector/Python (http://dev.mysql.com/downloads/connector/python/) sends an "empty" database name when a user doesn't specify one explicitly. This apparently causes schemarouter to hang.

      #!/usr/bin/env python
       
      import mysql.connector
       
      dbp = {
              'host':'127.0.0.1',
              'user':'kolbe',
              'password':'kolbe',
      #        'database':'shard1',
              'port':'3310'
              }
       
      cnx = mysql.connector.connect(**dbp)
      cnx.autocommit = True
       
      cur = cnx.cursor(prepared=False)
       
      stmt = "SELECT DATABASE()"
       
      cur.execute(stmt)
      for (i) in cur:
        print " database: %s " % i

      [skysql@max1 ~]$ python mysqltest.mysql_connector.py
      ^CTraceback (most recent call last):
        File "mysqltest.mysql_connector.py", line 13, in <module>
          cnx = mysql.connector.connect(**dbp)
        File "/usr/lib/python2.6/site-packages/mysql/connector/__init__.py", line 162, in connect
          return MySQLConnection(*args, **kwargs)
        File "/usr/lib/python2.6/site-packages/mysql/connector/connection.py", line 129, in __init__
          self.connect(**kwargs)
        File "/usr/lib/python2.6/site-packages/mysql/connector/connection.py", line 455, in connect
          self._post_connection()
        File "/usr/lib/python2.6/site-packages/mysql/connector/connection.py", line 434, in _post_connection
          self.set_charset_collation(self._charset_id)
        File "/usr/lib/python2.6/site-packages/mysql/connector/connection.py", line 1122, in set_charset_collation
          charset_name, collation_name))
        File "/usr/lib/python2.6/site-packages/mysql/connector/connection.py", line 1499, in _execute_query
          self.cmd_query(query)
        File "/usr/lib/python2.6/site-packages/mysql/connector/connection.py", line 722, in cmd_query
          result = self._handle_result(self._send_cmd(ServerCmd.QUERY, query))
        File "/usr/lib/python2.6/site-packages/mysql/connector/connection.py", line 510, in _send_cmd
          return self._socket.recv()
        File "/usr/lib/python2.6/site-packages/mysql/connector/network.py", line 262, in recv_py26_plain
          chunk = self.sock.recv(4)
      KeyboardInterrupt

      If I connect directly to a backend (changed port number in the Python source), I get this expected behavior:

      [skysql@max1 ~]$ python mysqltest.mysql_connector.py
       database: None

      Here's the trace log for the hang:

      2015-03-31 04:58:23   schemarouter: Client logging in directly to a database '', postponing until databases have been mapped.
      2015-03-31 04:58:23   Servers and connection counts:
      2015-03-31 04:58:23   MaxScale connections : 7 (7) in   127.0.0.1:3308 RUNNING (only)
      2015-03-31 04:58:23   MaxScale connections : 7 (7) in   127.0.0.1:3307 RUNNING (only)
      2015-03-31 04:58:23   Connected RUNNING (only) in       127.0.0.1:3308
      2015-03-31 04:58:23   Connected RUNNING (only) in       127.0.0.1:3307
      2015-03-31 04:58:23   Started Shard Router client session [84] for 'kolbe' from 127.0.0.1
      2015-03-31 04:58:23   [84]  schemarouter: <mariadb2, information_schema>
      2015-03-31 04:58:23   [84]  schemarouter: <mariadb2, mysql>
      2015-03-31 04:58:23   [84]  schemarouter: <mariadb2, performance_schema>
      2015-03-31 04:58:23   [84]  schemarouter: <mariadb2, shard2>
      2015-03-31 04:58:23   [84]  schemarouter: <mariadb2, test>
      2015-03-31 04:58:23   [84]  schemarouter: <mariadb1, shard1>
      2015-03-31 04:58:23   [84]  schemarouter: Connecting to a non-existent database ''

        Attachments

          Activity

            People

            Assignee:
            tturenko Timofey Turenko
            Reporter:
            kolbe Kolbe Kegel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.