Hi, I've run into a problem running SA 0.4.0 on top of psycopg2.  We
had a DNS hiccup, and the next attempt to execute a query triggered a
ProgrammingError.  Unfortunately, it seems that error didn't also
invalidate the (implicit) connection, which was then returned to the
pool.

Successive queries returned a couple different errors (I can track
down the exact sequence of errors if you need it) but eventually we
end up getting InvalidRequestError("This connection is closed") every
time we run a query.  The backtrace looks something like:

2007-12-04 08:10:10,585 ERROR    StorageWatcher-/build/storage-test/
release-Thread-2 - Unable to retrieve the list of builds on /build/
storage-test/release: This connection is closed
Traceback (most recent call last):
  File "/mts-cm/home/dbonner/clients/storagetest/bin/
storagemanager.py", line 844, in getBuildList
    builds = sess.query(Build).order_by(Build.buildid)\
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/orm/query.py", line
571, in all
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/orm/query.py", line
619, in __iter__
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/orm/query.py", line
622, in _execute_and_instances
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/orm/session.py", line
527, in execute
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/engine/base.py", line
779, in execute
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/engine/base.py", line
829, in _execute_clauseelement
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/engine/base.py", line
838, in _execute_compiled
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/engine/base.py", line
846, in __create_execution_context
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/databases/postgres.py",
line 303, in create_execution_context
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/engine/default.py",
line 157, in __init__
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/databases/postgres.py",
line 255, in create_cursor
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/pool.py", line 338, in
cursor
  File "/local/toolchain/lin32/python-2.4.3/lib/python2.4/site-
packages/SQLAlchemy-0.4.0-py2.4.egg/sqlalchemy/pool.py", line 327, in
invalidate
InvalidRequestError: This connection is closed


I poked around a little, and I'm guessing one fix might be to change
databases.postgres.PGDialect.is_disconnect() to treat the initial
ProgrammingError with "no route to host" in it as a disconnect error.
I just wanted to check and see if that was the right way to fix this
before I tried filing a trac ticket and submitting a patch.

Please let me know if I'm missing any useful details.  Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to