tox failures- sqlalchemy cannot connect to mysql database

Bug #1716463 reported by megan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
refstack
Fix Released
Undecided
Unassigned

Bug Description

[EXTENDED SUMMARY]: When running tox with the environment py*-func-mysql, sqlalchemy fails to connect to the internal MySQL server.

[ERROR MESSAGE]: sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'localhost' ([Errno 2] No such file or directory)")

[SUSPECTED CAUSE]: according to my quick precursory Google, it appears as though this error occurs when there is no MySQL server currently listening on port 3306.

[EXAMPLE TRACEBACK]:
Traceback (most recent call last):
  File "/opt/stack/refstack/refstack/tests/api/test_vendors.py", line 38, in setUp
    super(TestVendorsEndpoint, self).setUp()
  File "/opt/stack/refstack/refstack/tests/api/__init__.py", line 66, in setUp
    self.drop_all_tables_and_constraints()
  File "/opt/stack/refstack/refstack/tests/api/__init__.py", line 78, in drop_all_tables_and_constraints
    conn = engine.connect()
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2091, in connect
    return self._connection_cls(self, **kwargs)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 90, in __init__
    if connection is not None else engine.raw_connection()
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2177, in raw_connection
    self.pool.unique_connection, _connection)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2151, in _wrap_pool_connect
    e, dialect, self)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1465, in _handle_dbapi_exception_noconnection
    exc_info
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2147, in _wrap_pool_connect
    return fn()
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/pool.py", line 328, in unique_connection
    return _ConnectionFairy._checkout(self)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/pool.py", line 766, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/pool.py", line 516, in checkout
    rec = pool._do_get()
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/pool.py", line 1138, in _do_get
    self._dec_overflow()
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 187, in reraise
    raise value
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/pool.py", line 1135, in _do_get
    return self._create_connection()
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/pool.py", line 333, in _create_connection
    return _ConnectionRecord(self)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/pool.py", line 461, in __init__
    self.__connect(first_connect_check=True)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/pool.py", line 651, in __connect
    connection = pool._invoke_creator(self)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/engine/strategies.py", line 105, in connect
    return dialect.connect(*cargs, **cparams)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 393, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/pymysql/__init__.py", line 90, in Connect
    return Connection(*args, **kwargs)
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/pymysql/connections.py", line 706, in __init__
    self.connect()
  File "/opt/stack/refstack/.tox/py35-func-mysql/lib/python3.5/site-packages/pymysql/connections.py", line 963, in connect
    raise exc
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'localhost' ([Errno 2] No such file or directory)")

[FULL TRACEBACK]:
can be found at https://beta.etherpad.org/p/refstack_mysql_bug_traceback
(or by just running tox with py27-func-mysql)

megan (m.m.guiney)
description: updated
Revision history for this message
Martin Kopec (mkopec) wrote :

The tox environment mentioned above got moved to [functional] by:
https://opendev.org/osf/refstack/commit/35b3a1da4f0c1d59718517f787f40d19111c4c3e

It's passing now, so the bug got probably fixed over the time.

Changed in refstack:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.