Issue #3107 closed

MySQL server gone away

Juda Kaleta
created an issue

We are using SQLAlchemy to pool connections to MySQL server (together with django-mysqlpool). After upgrading to 0.9.6 many error like this have started to appear frequently.

sqlalchemy.pool.QueuePool   Exception during reset or similar

Traceback (most recent call last):
  File "/home/mcat/venv_sk/local/lib/python2.7/site-packages/sqlalchemy/", line 557, in _finalize_fairy
    fairy._reset(pool, echo)
  File "/home/mcat/venv_sk/local/lib/python2.7/site-packages/sqlalchemy/", line 688, in _reset
  File "/home/mcat/venv_sk/local/lib/python2.7/site-packages/sqlalchemy/", line 79, in do_rollback
OperationalError: (2006, 'MySQL server has gone away')

Recycle and other arguments passed to pool haven't changed and should be correct.

Comments (4)

  1. Mike Bayer repo owner

    After upgrading to 0.9.6

    after upgrading.... from what? 0.9.4? 0.6.7? This looks like you are just seeing the effects of #2752:

    Here's a simple program (an incorrect program, in order to illustrate this error) emitting the same output:

    from sqlalchemy import create_engine
    import gc
    import logging
    e = create_engine("mysql://scott:tiger@localhost/test", echo=True)
    c = e.connect()
    # incorrect method of closing - closing the DBAPI
    # connection directly
    # then don't actually close() so
    # that GC gets it insead
    del c
  2. Mike Bayer repo owner

    the exception in the above case is emitted on pretty much any SQLA version, it's just in 0.9 we are now showing it in the logs. Without further detail illustrating correct use leading to this failure there's not enough detail to show a bug.

  3. Log in to comment