Comment 5 for bug 1476708

Revision history for this message
Mike Bayer (zzzeek) wrote :

oslo.db reproduction case:

from oslo_db.sqlalchemy.session import create_engine

engine = create_engine("mysql://scott:tiger@localhost/test")

c1 = engine.connect()
c2 = engine.connect()

c1.scalar("select 1")
c2.scalar("select 1")
c1.close()
c2.close()

raw_input("shutdown")

try:
    conn = engine.connect()
except Exception as e:
    print "expected error: %s" % e

assert engine.pool._invalidate_time

try:
    c2 = engine.connect()
except Exception as e:
    print "expected error: %s" % e

c3 = engine.connect()

when the script pauses on "shutdown", shut off the MySQL database, then press enter to watch the failure. The failure will occur in SQLAlchemy 1.0.3 or greater, and should not occur in 1.0.2 or earlier. The underlying issue is still present in those versions as well as the 0.9 series however the specific case of the 'info' dictionary being involved occurs in 1.0.3, due to changes in the connection lifecycle to suit the HAAlchemy project.