1. Marcin Kuzminski
  2. RhodeCode
  3. Issues

Issues

Issue #535 resolved

wsgi multiprocess

Gilles Bouthenot
created an issue

When setting up Rhode code as described here: http://packages.python.org/RhodeCode/setup.html#setup

They are some very strange errors. First Apache frequently send a 500-Internal server error. This is triggered by the file site-packages/paste/evalexception :

{{{

!python

assert not environ['wsgi.multiprocess'], "The EvalException middleware is not usable in a" "multi-process environment")
}}}

The solution MAY be to not set processes=1 in the WSGIDaemonProcess.

quoting http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess: Note that if this option is defined as 'processes=1', then the WSGI environment attribute called 'wsgi.multiprocess' will be set to be True whereas not providing the option at all will result in the attribute being set to be False. This distinction is to allow for where some form of mapping mechanism might be used to distribute requests across multiple process groups and thus in effect it is still a multiprocess application. If you need to ensure that 'wsgi.multiprocess' is False so that interactive debuggers will work, simply do not specify the 'processes' option and allow the default single daemon process to be created in the process group.

Comments (5)

  1. Gilles Bouthenot reporter

    Another note. You should emphasis that the user/group information of the line WSGIDaemonProcess is very likely to be ignored: " Note that this option is ignored if Apache wasn't started as the root user, in which case no matter what the settings, the daemon processes will be run as the user that Apache was started as. "

    This cause some very strange error message (db file being readonly, or db file being "None", and cannot be read). In the later case, what is does mean it that rhodecode cannot create the "data" directory.

    So I guess the documentation should be altered to replace WSGIDaemonProcess pylons user=www-data group=www-data processes=1 \ threads=4 \ python-path=/home/web/rhodecode/pyenv/lib/python2.6/site-packages by: WSGIDaemonProcess pylons threads=4 \ python-path=/home/web/rhodecode/pyenv/lib/python2.6/site-packages

    and pointing to apache2-mpm-itw "Running apache2 virtualhost with different users" as in http://blog.andreaolivato.net/open-source/running-apache2-virtualhost-with-different-users.html, in order to run rhodecode under a defined user.

  2. Marcin Kuzminski repo owner

    Interactive debugger should be turned off odd that is throwing exceptions. are you sure you are using an .ini file with debug disabled ? I would leave the user,group since it will work if apache is started as root

  3. Gilles Bouthenot reporter

    (Reply via g...@atomas.com):

    Ok. I just suggest that you add some note in the documentation, like <<< Processes should be not set if you don't intend to use multi process ability. Setting processes=1 does not entirely disable multiprocess, and an error may be raised when the exception debugger is enabled. Also please note that user / group are only honored when apache is started as root. It is usually not the case. In that case, to run Rhodecode as a different user than your web server, you may have to use the apache2-mpm-itk, and use " <IfModule mpm_itk_module> AssignUserId USER GROUP </IfModule> " (see http://blog.andreaolivato.net/open-source/running-apache2-virtualhost-with-different-users.html)

    Because currently, it is very misleading. I am pretty sure that the vast majority of linux distribution don't run apache as root, as it is a *huge* security flaw, and also because the error message are completely incoherent ("cannot open database None").

    Thank you !

    2012/8/24 Marcin Kuzminski <issues-reply@bitbucket.org>:

  4. Marcin Kuzminski repo owner

    """Setting processes=1 does not entirely disable multiprocess, and an error may be raised when the exception debugger is enabled.""" I didn't know that, rhodecode really cannot be runned in multiprocess env. So i'll remove that option.

    Also add note *IF* apache is running as root optionally user can specify the user and group to run as.

    Thanks for your feedback !

  5. Log in to comment