[Zope3-Users] Need help with an urgent problem

kevin gill kevin at movieextras.ie
Wed Jan 7 08:28:24 EST 2009


Hi,

I am having a problem on my live site. The problem is todo with a DataBase
connector object which ends up in an incorrect state:

This is the important part of the traceback.

  File
"/home/kevin/src/castingzone.tables/castingzone/tables/person/extraaccount_db.py",
line 460, in IsValidUser
    result = self.execute('extraaccount.IsValidUser',
self.IsValidUser.__doc__, **params)
  File "/home/kevin/src/castingzone.utility/castingzone/utility/db/db.py",
line 125, in execute
    return queryForResults(connection, query)
  File "/home/kevin/src/castingzone.utility/castingzone/utility/db/db.py",
line 28, in queryForResults
    cursor.execute(query)
  File
"/srv/zope/hosting/castingzone/instance/hacks/psycopgda-1.0-py2.4.egg/psycopgda/adapter.py",
line 417, in execute
    return ZopeCursor.execute(self, operation, parameters)
  File
"/srv/zope/hosting/castingzone/eggs/zope.rdb-3.4.0-py2.4.egg/zope/rdb/__init__.py",
line 261, in execute
    operation, parameters = self._prepareOperation(operation, parameters)
  File
"/srv/zope/hosting/castingzone/eggs/zope.rdb-3.4.0-py2.4.egg/zope/rdb/__init__.py",
line 278, in _prepareOperation
    encoding = self.connection.getTypeInfo().getEncoding()
  File
"/srv/zope/hosting/castingzone/eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py",
line 798, in setstate
    raise ConnectionStateError(msg)
ConnectionStateError: Shouldn't load state for 0x1d54 when the connection
is closed

Once the server gets into this state, it seems to repeat often.

The object in question is a database connection object. I have just
retrieved it via an adapter lookup. It is not stored.

connection= zope.component.getUtility(IZopeDatabaseAdapter,  
CONNECTION_NAME, self.context)()

The database connection is provided by a global utility. The important
code is as follows:

def connection_directive(_context, name=CONNECTION_NAME,
    connection_string='', encoding='latin-1'):
    """Process a db:Connection zcml directive"""

    # Don't delay to the end of the configuration process -
    gAdapter = PsycopgAdapter(connection_string)
    gAdapter.setEncoding(encoding)
    gAdapter.connect()
    provideUtility(gAdapter, IZopeDatabaseAdapter, name)


Any help in narrowing down this problem would be greatly appreciated. It
is making my live system unworkable.

Thanks

Kevin






More information about the Zope3-users mailing list