[mod_python] Using dbpool in more than one place....

Michael C. Neel neel at mediapulse.com
Tue Sep 9 17:26:23 EST 2003


I'm currently trying to migrate an apache 1.3 / mod_python 2.7.8 site to
apache 2.x and mod_python 3.x.

I currently load two different mod_python modules for the site, one to
log hits to a database, the other to run site site pages.  I'm using
worker threads on apache, and trying to use dbpool to work around
MySQLdb's threading level 1.

The logging module connects to a remote 3.23.x Mysql box; the site
module connects to a local MySQL 4.x database.  If I disable one module,
the other (using dbpool) will run fine; it's when I try to run both I
get problems.  When I "import jon.dbpool as dbpool" on both, I get the
following errors in the global apache log:

Exception exceptions.RuntimeError: 'maximum recursion depth exceeded' in
<function _connection_notinuse at 0x41afbaac> ignored
Exception exceptions.TypeError: 'weak object has gone away' in <function
_connection_notinuse at 0x41afbaac> ignored

When I "import jon.dbpool as logger_dbpool" in the log module and
"import jon.dbpool as dbpool" in the site module I get the following
error in the sites log file:

Mod_python error: "PythonHandler www"

Traceback (most recent call last):

  File "/usr/local/lib/python2.3/site-packages/mod_python/apache.py",
line 338, in HandlerDispatch
    result = object(req)

  File "/home/sites/beta/modules/www.py", line 51, in handler
    c = db.cursor()

  File "/usr/local/lib/python2.3/site-packages/jon/dbpool.py", line 93,
in cursor
    return self._inner.cursor(*args, **kwargs)

  File "/usr/local/lib/python2.3/site-packages/jon/dbpool.py", line 129,
in cursor
    c = _Cursor(self, *args, **kwargs)

  File "/usr/local/lib/python2.3/site-packages/jon/dbpool.py", line 140,
in __init__
    self._outer = connection._outerref()

TypeError: 'NoneType' object is not callable


Is it possbile to use dbpool to connect to two different databases,
using two different mod_python modules?

Thanks,
Mike



More information about the Mod_python mailing list