← Back to team overview

agesys-dev team mailing list archive

[Bug 906183] [NEW] SQLAlchemy + oursql Connection Timeout Issue

 

Public bug reported:

i'm running into the MySQL timeout issue (MySQL server has gone away)
using oursql in conjunction with SQLAlchemy.  from the SQLAlchemy
documentation:

Connection Timeout

MySQL features an automatic connection close behavior, for connections
that have been idle for eight hours or more. To circumvent having this
issue, use the pool_recycle option which controls the maximum age of any
connection.

My application is a web application where i hold onto connections
persistently and i've added the pool_recycle option as suggested by
sqlalchemy, but wondering if somehow this is not being recognized by
oursql.  i have yet to look into any of the SQLAlchemy code to see if
what i imagine them to be doing is testing their connections
periodically to essentially keep it alive.

env:

Python = 2.7.1
SQLAlchemy = 0.7.3
oursql = 0.9.3
MySQL = 5.1.58
Linux = 2.6.x (64 bit)

here's a snippet of my python code, sorry I canot provide a runnable
reproducer at the moment:

conn_str = driver + 'mysql+oursql://' + user + ':' + password + '@' + host + ':' + \
    str(port) + '/' + db
    
self.engine = sqlalchemy.create_engine( conn_str, echo=False, pool_recycle=3600 )  # number of seconds for a connection
self.metadata = sqlalchemy.MetaData(bind=self.engine)
self.connection = self.engine.connect()
self.Session = sqlalchemy.orm.sessionmaker(bind=self.engine)
self.session = self.Session()

** Affects: oursql
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Agesys
Team, which is subscribed to oursql.
https://bugs.launchpad.net/bugs/906183

Title:
  SQLAlchemy + oursql Connection Timeout Issue

Status in oursql:
  New

Bug description:
  i'm running into the MySQL timeout issue (MySQL server has gone away)
  using oursql in conjunction with SQLAlchemy.  from the SQLAlchemy
  documentation:

  Connection Timeout

  MySQL features an automatic connection close behavior, for connections
  that have been idle for eight hours or more. To circumvent having this
  issue, use the pool_recycle option which controls the maximum age of
  any connection.

  My application is a web application where i hold onto connections
  persistently and i've added the pool_recycle option as suggested by
  sqlalchemy, but wondering if somehow this is not being recognized by
  oursql.  i have yet to look into any of the SQLAlchemy code to see if
  what i imagine them to be doing is testing their connections
  periodically to essentially keep it alive.

  env:

  Python = 2.7.1
  SQLAlchemy = 0.7.3
  oursql = 0.9.3
  MySQL = 5.1.58
  Linux = 2.6.x (64 bit)

  here's a snippet of my python code, sorry I canot provide a runnable
  reproducer at the moment:

  conn_str = driver + 'mysql+oursql://' + user + ':' + password + '@' + host + ':' + \
      str(port) + '/' + db
      
  self.engine = sqlalchemy.create_engine( conn_str, echo=False, pool_recycle=3600 )  # number of seconds for a connection
  self.metadata = sqlalchemy.MetaData(bind=self.engine)
  self.connection = self.engine.connect()
  self.Session = sqlalchemy.orm.sessionmaker(bind=self.engine)
  self.session = self.Session()

To manage notifications about this bug go to:
https://bugs.launchpad.net/oursql/+bug/906183/+subscriptions


Follow ups

References