Description
In a wiki farm configuration files for the storage of sessions are not stored in a per wiki directory.
Steps to reproduce
- Have a wiki farm running as described in the details.
- Empty the session_dir
rm /srv/www/wiki1/data/cache/__session__/*
- Restart the web server.
Access one wiki (http://test/wiki1)
- Login to this wiki.
- Look into the session_dir and find your session
ll /srv/www/wiki1/data/cache/__session__
- Optional: Verify your cookie with the file name.
Access another wiki (http://test/wiki2)
- Login to this wiki.
- Look into the session_dir of wiki1 and find your session on wiki2
ll /srv/www/wiki1/data/cache/__session__
- ...
- Look into the session_dir of wiki2 and find out it is empty.
When another process starts serving it will use another session_dir and the users will have to login again.
The above always leads to the situation that the first wiki used within a process will contain the session files.
Example
Component selection
MoinMoin.web.session
Details
MoinMoin Version |
1.9.0 |
OS and Version |
SunOS sun 5.10 Generic_142901-01 i86pc i386 i86pc |
Python Version |
Python 2.6.1 |
Server Setup |
Apache 2.2.11 with mod_wsgi/3.1 |
Server Details |
mpm_prefork |
Language you are using the wiki in (set in the browser/UserPreferences) |
de |
- Apache/mod_wsgi configuration:
global:
<IfModule wsgi_module>
# configure a daemon process group
WSGIDaemonProcess moin-wsgi user=webservd group=webservd home=/srv/www/empty display-name=moin-wsgi processes=1 threads=1 umask=0007
# PROBLEM: processes/threads set to 1 to get a static session_dir in moin
# disable embedded mode
WSGIRestrictEmbedded On
# enable some restrictions for wsgi compliant applications
WSGIRestrictStdin On
WSGIRestrictStdout On
WSGIRestrictSignal On
</IfModule>
VirtualHost
# define default wsgi execution environment
WSGIProcessGroup moin-wsgi
WSGIApplicationGroup moin-wsgi
# preload our script
WSGIImportScript "/srv/www/wiki/cgi-bin/moin.wsgi" process-group=moin-wsgi application-group=moin-wsgi
#
# Wikis
#
# /wiki1
WSGIScriptAlias /wiki1 "/srv/www/wiki/cgi-bin/moin.wsgi"
...On /SystemInfo the correct session_dir per wiki is shown on all wikis.
'/srv/www/wiki1/data/cache/__session__' '/srv/www/wiki2/data/cache/__session__' ...
- In the apache error_log I see a lot of:
[Wed Dec 09 15:54:03 2009] [error] Exception RuntimeError: 'maximum recursion depth exceeded while calling a Python object' in <type 'exceptions.AttributeError'> ignored
- But this might have nothing to do with the problem.
- moin.wsgi
import sys, os
sys.path.insert(0, '/opt/moin/lib/python2.6/site-packages')
sys.path.insert(0, '/opt/webstack/python/lib/python2.6/site-packages')
sys.path.insert(0, '/srv/www/wiki/')
from MoinMoin import log
log.load_config('/srv/www/wiki/logfile')
from MoinMoin.web.serving import make_application
application = make_application(shared=False)- farmconfig.py
wikis = [
("wiki1", r"^https?://test/wiki1.*"),
("wiki2", r"^https?://test/wiki2.*"),
]
from MoinMoin.config import multiconfig, url_prefix_static
class FarmConfig(multiconfig.DefaultConfig):
data_underlay_dir = '/srv/www/wiki1/underlay/'
superuser = [u"root", ]
acl_rights_before = u"root:read,write,delete,revert,admin"
surge_action_limits = { # allow max. <count> <action> requests per <dt> secs
# action: (count, dt)
'show': (20, 5),
'raw': (20, 5), # some people use this for css
'AttachFile': (100, 5),
'diff': (30, 60),
'fullsearch': (10, 60),
'edit': (20, 60),
'rss_rc': (5, 60),
'default': (30, 30),
}
surge_lockout_time = 60 # secs you get locked out when you ignore warnings
edit_locking = 'lock 5'
from MoinMoin.security.autoadmin import SecurityPolicy
mail_smarthost = "localhost"
mail_from = u"root"
navi_bar = [
# If you want to show your page_front_page here:
#u'%(page_front_page)s',
u'RecentChanges',
u'FindPage',
u'HelpContents',
]
theme_default = 'modernized'
language_default = 'de'
show_hosts = False
logo_string = u'<img src="' + url_prefix_static + u'/common/moinmoin.png" alt="MoinMoin Logo">'
page_front_page = u"MeineStartSeite"
shared_intermap = '/opt/moin/share/moin/data/intermap.txt'
log_reverse_dns_lookups = False
log_remote_addr = False
xapian_search = True
xapian_index_history = True
xapian_stemming = True- wiki1.py
from farmconfig import FarmConfig
class Config(FarmConfig):
data_dir = '/srv/www/wiki1/data/'
...- browser cookie
- The cookie path always seems to fit. It is set on a per wiki base ("/wiki1" on wiki1 ...).
Workaround
- Set processes/threads configuration to 1 to get a static session_dir at least.
- When reloading apache, always try to load a page of the same wiki first to set the session_dir to that one.
A better solution to get back per wiki session directories (thanks to ThomasWaldmann).
- Add two lines to the configuration of each wiki (here wiki1.py and wiki2.py):
from farmconfig import FarmConfig class Config(FarmConfig): ... from MoinMoin.web.session import FileSessionService session_service = FileSessionService()
- Add two lines to the configuration of each wiki (here wiki1.py and wiki2.py):
Discussion
Initialisation of FilesystemSessionStore instance is done wrong.
Tested: Fixed by http://hg.moinmo.in/moin/1.9/rev/437558fff184 .
Plan
- Priority:
- Assigned to:
Status: fixed by http://hg.moinmo.in/moin/1.9/rev/437558fff184
