#120 infinitiv recursion in Transaction.__del__

closed-fixed
None
5
2006-08-22
2005-10-22
M. Dietrich
No

using ThreadConnections i get a

Exception exceptions.RuntimeError: 'maximum recursion
depth exceeded' in <bound method Transaction.__del__ of
<sqlobject.dbconnection.Transaction object at
0xaedb714c>> ignored

, commenting __del__() works in the first place. can't
figure out what this __del__ is for...

Discussion

  • Oleg Broytman

    Oleg Broytman - 2005-10-25

    Logged In: YES
    user_id=4799

    Can you make a little test program that demonstrates the
    problem?

     
  • xiao hai tong

    xiao hai tong - 2005-12-04

    Logged In: YES
    user_id=146934

    I encount it too.

    once is too many connection crash my pgsql server on
    windows, then may of such exceptions reported.

    other time:
    a multi thread test program.

    I want to retry my transaction when excecption occured
    during commit, I commet the threadConnection.rollback(),
    just set
    threadConnection = g_conn.transaction(), and redo the
    transaction

    after seconds, such exceptions occurred.

     
  • Didrik Pinte

    Didrik Pinte - 2006-01-24

    Logged In: YES
    user_id=970259

    Same here,

    I can reproduce it. It happens when the database is not started.

    Here is a test code :

    Step 1 :
    Shut down you postgres server

    Step 2 : Run the following
    -------------------------
    import sqlobject

    scheme = "postgres://myusername:mypassword@localhost/mydb"
    connection = sqlobject.connectionForURI(scheme)
    sqlobject.sqlhub.processConnection = connection
    sqlhub.threadConnection = connection.transaction()
    --------------------------

    Didrik

     
  • Oleg Broytman

    Oleg Broytman - 2006-02-06

    Logged In: YES
    user_id=4799

    I cannot reproduce it. When Postgres is not started your
    program is just reports

    Traceback (most recent call last):
    File "./test1.py", line 10, in ?
    sqlhub.threadConnection = connection.transaction()
    File
    "/usr/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1534-py2.4.egg/sqlobject/dbconnection.py",
    line 354, in transaction
    return Transaction(self)
    File
    "/usr/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1534-py2.4.egg/sqlobject/dbconnection.py",
    line 731, in __init__
    self._connection = dbConnection.getConnection()
    File
    "/usr/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1534-py2.4.egg/sqlobject/dbconnection.py",
    line 226, in getConnection
    conn = self.makeConnection()
    File
    "/usr/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1534-py2.4.egg/sqlobject/postgres/pgconnection.py",
    line 108, in makeConnection
    raise self.module.OperationalError("%s; used connection
    string %r" % (e, self.dsn))
    psycopg.OperationalError: could not connect to server: @╠
    Is the server running locally and accepting
    connections on Unix domain socket
    "/var/run/postgresql/.s.PGSQL.5432"?
    ; used connection string 'dbname=test'
    Exception exceptions.AttributeError: "PostgresConnection
    instance has no attribute '_connection'" in <bound method
    Transaction.__del__ of <sqlobject.dbconnection.Transaction
    object at 0xb7b6ddec>> ignored

     
  • Nobody/Anonymous

    Logged In: NO

    In my case, this was caused by an exception happening in the
    __init__ method of Transaction. The __del__ then tried to
    use self._obsolete, which had not yet been defined causing
    __getattr__ to be used which then tried to use more
    undefined stuff.

    --- sqlobject/dbconnection.py~ Thu Dec 23 11:52:32 2004
    +++ sqlobject/dbconnection.py Fri Mar 10 19:16:24 2006
    @@ -473,11 +473,11 @@
    class Transaction(object):

    def __init__(self, dbConnection):
    + self.cache = CacheSet(cache=dbConnection.doCache)
    + self._obsolete = False
    self._dbConnection = dbConnection
    self._connection = dbConnection.getConnection()
    self._dbConnection._setAutoCommit(self._connection, 0)
    - self.cache = CacheSet(cache=dbConnection.doCache)
    - self._obsolete = False

    def assertActive(self):
    assert not self._obsolete, "This transaction has
    already gone through COMMIT/ROLLBACK; create another
    transaction"

     
  • Oleg Broytman

    Oleg Broytman - 2006-08-22

    Logged In: YES
    user_id=4799

    That's been fixed in the revision 1838.

     
  • Oleg Broytman

    Oleg Broytman - 2006-08-22
    • assigned_to: nobody --> phd
    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks