Closed
Description
Migrated issue, originally created by Anonymous
I was using SQLALchemy 0.4.3 to read a simple Oracle table in an endless loop when I shut down the server (on purpose). Apparently this was noticed after the query was executed but during the fetches on the ResultProxy. The resulting cx_Oracle exception was not wrapped in a subclass of DBAPIError. The following code reproduces the problem reliably if you have the server up at the start then take it down before hitting Return.
import sys
from sqlalchemy import (create_engine, MetaData, Table, Column,
Integer, String)
engine = create_engine(sys.argv[1](1))
meta = MetaData(bind=engine)
example = Table("example",
meta,
Column("id", Integer, primary_key=True),
Column("name", String(20))
)
meta.drop_all()
meta.create_all()
example.insert().execute(id=1, name="George")
example.insert().execute(id=2, name="Ursula")
example.insert().execute(id=3, name="Ape")
example.insert().execute(id=4, name="Shep")
example.insert().execute(id=5, name="TookieTookie")
rows = example.select().execute()
raw_input("Type return when the server is down.")
print list(rows)
Type return when the server is down.
Traceback (most recent call last):
File "sabug.py", line 23, in <module>
print list(rows)
File "/tmp/SQLAlchemy-0.4.3/lib/sqlalchemy/engine/base.py", line 1533, in __iter__
row = self.fetchone()
File "/tmp/SQLAlchemy-0.4.3/lib/sqlalchemy/engine/base.py", line 1633, in fetchone
row = self._fetchone_impl()
File "/tmp/SQLAlchemy-0.4.3/lib/sqlalchemy/engine/base.py", line 1608, in _fetchone_impl
return self.cursor.fetchone()
cx_Oracle.DatabaseError: ORA-03113: end-of-file on communication channel
Attachments: result_catches.patch
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
sqlalchemy-bot commentedon Feb 24, 2008
Michael Bayer (@zzzeek) wrote:
ive attached a patch for this, i was wondering can you just test this out with your particular setup ? I think we can probably add tests to test/engine/reconnect.py for this particular issue as well.
sqlalchemy-bot commentedon Feb 24, 2008
Changes by Michael Bayer (@zzzeek):
sqlalchemy-bot commentedon Feb 24, 2008
Anonymous wrote:
That works, thanks. By the way, I see the same thing in 0.3.6 so you may need to patch 0.3.11 as well.
sqlalchemy-bot commentedon Feb 25, 2008
Michael Bayer (@zzzeek) wrote:
er, 0.3 doesn't have the infrastructure needed for this in place; theres several other places the catch is needed including
set_input_sizes()
, which is used by oracle. The reconnect logic itself was also overhauled in 0.4 as it wasn't working that great in 0.3...so a backport from 0.4 into 0.3 would be a significant job. It would be less work overall if you could upgrade to 0.4, its a pretty easy upgrade path since you can move to 0.3.11, make your app forwards-compatible with 0.4, then move to 0.4.sqlalchemy-bot commentedon Feb 25, 2008
Michael Bayer (@zzzeek) wrote:
0.4 version is fixed in 47418e0
sqlalchemy-bot commentedon Mar 11, 2008
Michael Bayer (@zzzeek) wrote:
going to leave 0.3 alone
sqlalchemy-bot commentedon Mar 11, 2008
Changes by Michael Bayer (@zzzeek):