[mod_python] DbmSession/dbhash crashes using mod_python 3.1.2b

Michael Kleehammer michael at kleehammer.com
Mon Nov 17 23:23:30 EST 2003

Whenever I attempt to use sessions, the DbmSession class chooses the
dbhash module and crashes when attempting to create the database.  (The
file is never created.)

* Fedora Core 1 (basically RH9)
* Newly compiled Apache 2.0.48
* Python 2.3
* mod_python 3.1.2b

Here is a small handler that exhibits the problem on my box.  If it runs
on anyone else's box, that would be good to know.

  from mod_python import apache
  import dbhash
  def handler(req):
      req.log_error("open", apache.APLOG_NOTICE)
      # seg fault in here
      result = dbhash.open('/tmp/mp_sess.dbm', 'c', apache.APLOG_NOTICE)
      return apache.OK

The relevant Apache error log lines are:

  [notice] mod_python: (Re)importing module 'controller'
  [notice] [client] open
  [notice] child pid 11211 exit signal Segmentation fault (11)

Naturally, I've tested similar code outside of mod_python and it works
fine.  I'm wondering if dbhash is thread safe.

Obviously I can call DbmSession instead of Session and pass dumbdbm (or
another type -- I haven't tested any others yet), but I'm wondering why
the default setup isn't working.

Any thoughts?

Michael Kleehammer

More information about the Mod_python mailing list