[mod_python] Few lines of code that make my mod_python crash

Cassiano, Marco mcassiano at manord.com
Fri May 13 11:47:25 EDT 2005


Hi all,
 
Please, look at these few lines of code :
 
import shelve
 
def test(req):
        s=shelve.open('/tmp/test')
        return 'OK'
 
I have a Linux box with RedHat 3 AS, ActiveState Python 2.4.1,
Mod_python 3.1.4 (compiled with the --with-python option) (but I also
tried with python 2.4.1 from www.python.org <http://www.python.org/>  ,
compiled with BerkeleyDB 4.3 from sleepycat (also tried versione 4.2)
and with mod_python 3.1.4 compiled with the --with-python option).
 
The version of Apache is 2.0.46-25.ent 
 
If I try to execute these few lines from mod_python I get the error you
can see below (also tried with mod_python_servlets, same result, see
bottom of the message)
If I execute the same lines one at a time from the python interpreter or
If I run a script version of these lines from the bash prompt (e.g.
python scripttest.py) they work perfectly.
 
Any suggestion?
Thank you
 
Marco Cassiano
 
 
The Publisher output
----------------------
 
Mod_python error: "PythonHandler mod_python.publisher"
 
Traceback (most recent call last):
 
  File
"/usr/local/python2.4/lib/python2.4/site-packages/mod_python/apache.py",
line 299, in HandlerDispatch
    result = object(req)
 
  File
"/usr/local/python2.4/lib/python2.4/site-packages/mod_python/publisher.p
y", line 136, in handler
    result = util.apply_fs_data(object, req.form, req=req)
 
  File
"/usr/local/python2.4/lib/python2.4/site-packages/mod_python/util.py",
line 361, in apply_fs_data
    return object(**args)
 
  File "/discoe/script/cgi/cgi-mpy/marco.py", line 6, in test
    s=shelve.open('/tmp/test')
 
  File "/usr/local/python2.4/lib/python2.4/shelve.py", line 231, in open
    return DbfilenameShelf(filename, flag, protocol, writeback, binary)
 
  File "/usr/local/python2.4/lib/python2.4/shelve.py", line 212, in
__init__
    Shelf.__init__(self, anydbm.open(filename, flag), protocol,
writeback, binary)
 
  File "/usr/local/python2.4/lib/python2.4/anydbm.py", line 83, in open
    return mod.open(file, flag, mode)
 
  File "/usr/local/python2.4/lib/python2.4/dbhash.py", line 16, in open
    return bsddb.hashopen(file, flag, mode)
 
  File "/usr/local/python2.4/lib/python2.4/bsddb/__init__.py", line 285,
in hashopen
    e = _openDBEnv()
 
  File "/usr/local/python2.4/lib/python2.4/bsddb/__init__.py", line 339,
in _openDBEnv
    e.open('.', db.DB_PRIVATE | db.DB_CREATE | db.DB_THREAD |
db.DB_INIT_LOCK | db.DB_INIT_MPOOL)
 
DBError: (141528656, 'Unknown error 141528656')
 
 
The servlet version :
 
import shelve
from mod_python.servlet import HTMLPage
 
class marcos(HTMLPage):
        
        def write_content(self):
 
                s=shelve.open('/tmp/test')
                return 'OK'
 
 
 
The servlet output :
 
 
Mod_python error: "PythonHandler mod_python.servlet"
 
Traceback (most recent call last):
 
  File
"/usr/local/python2.4/lib/python2.4/site-packages/mod_python/apache.py",
line 299, in HandlerDispatch
    result = object(req)
 
  File
"/usr/local/python2.4/lib/python2.4/site-packages/mod_python/servlet.py"
, line 1465, in handler
    if not servlet.respond():
 
  File
"/usr/local/python2.4/lib/python2.4/site-packages/mod_python/servlet.py"
, line 918, in respond
    return Servlet.respond(self) or self.write_html()
 
  File
"/usr/local/python2.4/lib/python2.4/site-packages/mod_python/servlet.py"
, line 938, in write_html
    self.write_body()
 
  File
"/usr/local/python2.4/lib/python2.4/site-packages/mod_python/servlet.py"
, line 1212, in write_body
    self.write_body_parts()
 
  File
"/usr/local/python2.4/lib/python2.4/site-packages/mod_python/servlet.py"
, line 1233, in write_body_parts
    self.write_content()
 
  File "/discoe/script/cgi/cgi-mpy/marcos.mps", line 9, in write_content
    s=shelve.open('/tmp/test')
 
  File "/usr/local/python2.4/lib/python2.4/shelve.py", line 231, in open
    return DbfilenameShelf(filename, flag, protocol, writeback, binary)
 
  File "/usr/local/python2.4/lib/python2.4/shelve.py", line 212, in
__init__
    Shelf.__init__(self, anydbm.open(filename, flag), protocol,
writeback, binary)
 
  File "/usr/local/python2.4/lib/python2.4/anydbm.py", line 83, in open
    return mod.open(file, flag, mode)
 
  File "/usr/local/python2.4/lib/python2.4/dbhash.py", line 16, in open
    return bsddb.hashopen(file, flag, mode)
 
  File "/usr/local/python2.4/lib/python2.4/bsddb/__init__.py", line 285,
in hashopen
    e = _openDBEnv()
 
  File "/usr/local/python2.4/lib/python2.4/bsddb/__init__.py", line 339,
in _openDBEnv
    e.open('.', db.DB_PRIVATE | db.DB_CREATE | db.DB_THREAD |
db.DB_INIT_LOCK | db.DB_INIT_MPOOL)
 

DBError: (142908256, 'Unknown error 142908256')

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050513/3e657888/attachment-0001.html


More information about the Mod_python mailing list