On Mar 27, 2014, at 10:03 AM, Tim Tisdall <[email protected]> wrote:

> Today I found the following traceback in my logs:
> 
> 2014-03-27 13:55:59,876 ERROR [sqlalchemy.pool.QueuePool _close_connection 
> b'uWSGIWorker2Core14'] Exception closing connection <oursql.Connection object 
> at 0x7fecfdf6a140>
> Traceback (most recent call last):
>   File 
> "/sites/ColanderAlchemy/SQLAlchemy-0.9.3-py3.3-linux-x86_64.egg/sqlalchemy/pool.py",
>  line 243, in _close_connection
>     self._dialect.do_close(connection)
>   File 
> "/sites/ColanderAlchemy/SQLAlchemy-0.9.3-py3.3-linux-x86_64.egg/sqlalchemy/engine/default.py",
>  line 401, in do_close
>     dbapi_connection.close()
>   File "connection.pyx", line 193, in oursql.Connection.close 
> (oursqlx/oursql.c:6143)
>   File "connection.pyx", line 240, in oursql.Connection.rollback 
> (oursqlx/oursql.c:6562)
>   File "connection.pyx", line 207, in oursql.Connection._raise_error 
> (oursqlx/oursql.c:6317)
> oursql.OperationalError: (2006, 'MySQL server has gone away', None)
> 
> Shouldn't SQLAlchemy closing a connection catch this type of exception and 
> ignore it?  If the mysql connection "has gone away", can it not be considered 
> "closed"?

there's a difference between "ignore" and "silent". Here's the code:

    def _close_connection(self, connection):
        self.logger.debug("Closing connection %r", connection)
        try:
            self._dialect.do_close(connection)
        except (SystemExit, KeyboardInterrupt):
            raise
        except:
            self.logger.error("Exception closing connection %r",
                            connection, exc_info=True)

as you can see, the error is ignored, we just log that something unexpected and 
possibly problematic has happened.    I don't think this is necessarily a bad 
thing.



-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to