[ZODB-Dev] Connection lost using RelStorage on Oracle 10g

Shane Hathaway shane at hathawaymix.org
Sat Jan 31 14:33:59 EST 2009


Riccardo Minet wrote:
> Module relstorage.relstorage, line 983, in poll_invalidations
> Module relstorage.relstorage, line 154, in _restart_load
> Module relstorage.adapters.oracle, line 351, in restart_load
> 
> DatabaseError: ORA-03135: connection lost contact

It's happening right at a point where RelStorage is designed to 
reconnect automatically, but cx_Oracle is raising the wrong exception. 
Look at line 353 of relstorage/adapters/oracle.py.  RelStorage knows 
what to do if cx_Oracle raises OperationalError or InterfaceError, but 
cx_Oracle raises DatabaseError instead.  Shame on cx_Oracle: any 
disconnection should be an operational error, not a generic database error.

There's an easy fix.  I'd like you to change line 353 to handle 
DatabaseError in addition to the error types it already handles.  It 
currently looks like this:

     except (cx_Oracle.OperationalError, cx_Oracle.InterfaceError), e:

Change it to this:

     except (cx_Oracle.OperationalError, cx_Oracle.InterfaceError,
         cx_Oracle.DatabaseError), e:

If that change works, I will include it in the next release of RelStorage.

Shane



More information about the ZODB-Dev mailing list