[mod_python] The Session problem with mod_python3.2.7

Gavin gavin at sz.net.cn
Tue Feb 21 06:14:00 EST 2006


> 
> On 21/02/2006, at 9:25 PM, Gavin wrote:
> 
>>> On 21/02/2006, at 5:41 PM, Gavin wrote:
>>>
>>>> hello Graham
>>>>
>>>> Thank you!
>>>> My configuration is as following:
>>>>
>>>> <Directory "/data/HTTPD/htdocs/FeedBack">
>>>>
>>>>   AddHandler mod_python  .m
>>>
>>> Do you really mean ".m"? Don't you mean ".psp, how else can you use
>>> "sid.psp"
>>> as file name?
>>>
>> Right. I use sid.m.
> 
> In the URL, or for the file? Its a bit confusing. Is there are reason  
> you want
> to use ".m" extension?
> 
> Anyway, when I take the PSP code you posted and which you referred to
> as "sid.psp" and put in a directory with .htaccess file of:
> 
> AddHandler mod_python .psp
> PythonHandler mod_python.psp
> PythonDebug On
> 
> If I access it as sid.psp in URL, the code works as expected.
> 
>>>>   PythonHandler mod_python.psp
>>>>   #PythonHandler mod_python.publisher
>>>>   PythonPath "['/data/HTTPD/py_api']+['/data/HTTPD/htdocs/FeedBack']
>>>> +sys.path"
>>>>   PythonDebug Off
>>>>   Options Indexes FollowSymLinks
>>>>   Order deny,allow
>>>>   Allow from all
>>>>
>>>> </Directory>
>>>>
>>>> I don't use PythonOption to override the either "session_dbm" or
>>>> "session_directory"
>>>>
>>>
>>> All I can suggest then is to look for the file:
>>>
>>>   /tmp/mp_sess.dbm.db
>>>
>>> or something named similarly. I don't think it is meant to have extra
>>> ".db" extension
>>> but on my Mac there is one for some reason.
>>>
>>>
>> Cann't found any file like mp* under /tmp
> 
> All I can suggest then is to modify lib/python/mod_python/Session.py in
> mod_python source code and add in some debug statements to see what
> session database name is being set to.
> 
> class DbmSession(BaseSession):
> 
>     def __init__(self, req, dbm=None, sid=0, secret=None,  
> dbmtype=anydbm,
>                  timeout=0, lock=1):
> 
>         if not dbm:
>             opts = req.get_options()
>             if opts.has_key("session_dbm"):
>                 dbm = opts["session_dbm"]
>             else:
>                 dbm = os.path.join(opts.get('session_directory',  
> tempdir), 'mp_sess.dbm')
> 
>         self._dbmfile = dbm
>         self._dbmtype = dbmtype
> 
>         # XXX DEBUG
> 
>         apache.log_error("dbmfile=%s"%self._dbmfile)
> 
> Reinstall mod_python and restart Apache.
> 
> Then when running test, look in Apache error_log to see where it  
> thinks it is getting
> put. See if file exists if not in /tmp.
> 
mp_sess_test.dbm file doesn't exists in /tmp. error_log file are as following:


[Tue Feb 21 19:23:14 2006] [error] dbmfile=/tmp/mp_sess_test.dbm
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp: Traceback (most recent call last):
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch\n    result = object(req)
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/site-packages/mod_python/psp.py", line 302, in handler\n    p.run()
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/site-packages/mod_python/psp.py", line 213, in run\n    exec code in global_scope
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/data/HTTPD/htdocs/intapp/sid.m", line 6, in ?\n    S=Session.Session(req)
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/site-packages/mod_python/Session.py", line 699, in Session\n    timeout=timeout, lock=lock)
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/site-packages/mod_python/Session.py", line 301, in __init__\n    timeout=timeout, lock=lock)
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/site-packages/mod_python/Session.py", line 129, in __init__\n    if self.load():
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/site-packages/mod_python/Session.py", line 188, in load\n    dict = self.do_load()
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/site-packages/mod_python/Session.py", line 322, in do_load\n    dbm = self._get_dbm()
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/site-packages/mod_python/Session.py", line 309, in _get_dbm\n    result = self._dbmtype.open(self._dbmfile, 'c')
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/anydbm.py", line 83, in open\n    return mod.open(file, flag, mode)
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/dbhash.py", line 16, in open\n    return bsddb.hashopen(file, flag, mode)
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/bsddb/__init__.py", line 285, in hashopen\n    e = _openDBEnv()
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp:   File "/usr/local/lib/python2.4/bsddb/__init__.py", line 339, in _openDBEnv\n    e.open('.', db.DB_PRIVATE | db.DB_CREATE | db.DB_THREAD | db.DB_INIT_LOCK | db.DB_INIT_MPOOL)
[Tue Feb 21 19:23:14 2006] [error] [client 202.104.96.163] PythonHandler mod_python.psp: DBError: (137263248, 'Unknown error 137263248')

> Graham
>



More information about the Mod_python mailing list