Ok. This did not work and I dug this thread where you had a discussion on this. It seems like this was fixed in sqlalchemy and you were calling rollback twice which caused this issue.
http://groups.google.com/group/sqlalchemy/browse_thread/thread/9412808e695168ea/c31f5c967c135be0?lnk=raot Unfortunately the symptoms are the same but I wanted to run by some connection code that I'm using to get a connection and start a transaction to check whether this could potentially cause any issues. Note that this decorator is called on any method running sql. It basically wraps the function by creating the connection and then closing it. engine = create_engine(dburi, pool_size=100, pool_recycle=7200) def transaction(func): def do(*args, **kw): connection = engine.connect() transaction = connection.begin() try: # create some context here for the connection and pass it through to later execute ret = func(ctx, *args, **kw) transaction.commit() connection.close() return ret except: # rollback for now transaction.rollback() connection.close() return do I highly doubt this is causing any issues because pylons wsgi server is getting a resource not found on the very first db attempt. There really should be no rolling back on my end unless connection.close() or so is throwing an exception. Should I be using connection.ping()? Will this slow things down? Any other suggestions on how to fix this? Using MySQL 5.0.27 and sqlalchemy 0.3.8. Thanks. Sam On Jul 14, 11:07 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Jul 15, 1:02 am, SamDonaldson <[EMAIL PROTECTED]> wrote: > > > Not to ask to many questions here but isn't there a standard value for > > this? I mean, who would want their db connections to close > > unexpectedly like this, especially on a live site? Is there a value > > you recommend because this is just happening way too frequently. > > OK...the FAQ entry says, "its usually 8 hours for MySQL". im not > exactly sure if thats what it is on your server, since you said "every > few hours". if your server seems to kill connections "every few > hours", seems like you should set your timeout to like an hour or > so ? even if you set it to 10 minutes it wouldnt hurt much. > > AFAIK only mysql does this connection timeout thing in the first > place. > > if youre asking, shouldnt this be on by default, maybe, since it > doesnt hurt much. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
