Unable to connect to WSGI daemon process

Louis Bertrand Louis.Bertrand at durhamcollege.ca
Sun Aug 2 19:03:23 UTC 2020


Hi Mads,
Sorry for the top quoting. MS Outlook...

Yes, we are using WSGI to manage Kallithea, on Ubuntu server 18.04.4 LTS with Apache2.

The mod-wsgi that we are using (from apt list):
libapache2-mod-wsgi-py3/bionic-updates,now 4.5.17-1ubuntu1 amd64 [installed]

We got the configuration option from the WSGI documentation:
https://modwsgi.readthedocs.io/en/develop/configuration-directives/WSGIDaemonProcess.html

Generally our server configuration matches what you recommend in the installation documentation:

        WSGIDaemonProcess       kallithea processes=5 threads=1 maximum-requests=100 lang=en_US.utf8 user=hg group=hg socket-user=hg python-home=/srv/web/sites/hg.set.durhamcollege.org/kallithea-venv
        WSGIProcessGroup        kallithea
        WSGIScriptAlias /       /srv/web/sites/hg.set.durhamcollege.org/kallithea/dispatch.wsgi
        WSGIPassAuthorization   On

The dispatch script is:
    import os
    os.environ['PYTHON_EGG_CACHE'] = '/srv/web/sites/hg.set.durhamcollege.org/kallithea/.egg-cache'

    os.chdir('/srv/web/sites/hg.set.durhamcollege.org/kallithea/')

    import site
    site.addsitedir("/srv/web/sites/hg.set.durhamcollege.org/kallithea-venv/lib/python3.6/site-packages")

    ini = '/srv/web/sites/hg.set.durhamcollege.org/kallithea/my.ini'
    from logging.config import fileConfig
    fileConfig(ini, {'__file__': ini, 'here': '/srv/web/sites/hg.set.durhamcollege.org/kallithea'})
    from paste.deploy import loadapp
    application = loadapp('config:' + ini)


Hope this helps
 --Louis

________________________________________
From: Mads Kiilerich <mads at kiilerich.com>
Sent: Saturday, August 1, 2020 4:49 PM
To: Louis Bertrand; Kallithea
Subject: Re: Unable to connect to WSGI daemon process

[EXTERNAL EMAIL]

On 7/31/20 4:37 PM, Louis Bertrand wrote:
> There was a disconnect between Apache and the Kallithea WSGI daemon process. The WSGI daemon was unable to read the socket. The exact error message in Apache's logs/ssl-errors is
>
> [Thu Jul 30 17:52:34.396927 2020] [wsgi:error] [pid 10169] (13)Permission denied: [client 216.blahblah:58674] mod_wsgi (pid=10169): Unable to connect to WSGI daemon process 'kallithea' on '/var/run/apache2/wsgi.10110.0.1.sock' as user with uid=1003.
>
> where user 1003 is 'hg', the Linux Kallithea user.
>
> Solved by adding
> socket-user=hg
> on the WSGIDaemonProcess line in the Apache WSGI configuration and restarting Apache


This must be when using mod_wsgi. Is it configured pretty much like
outlined in the Kallithea documentation?

socket-user seems to be a recent addition, and this is might thus not be
a general solution.

What mod_wsgi version and which OS and version are you using?

To help us review and assess how general this is: What led to this
solution? Any external references?

/Mads

________________________________

________________________________
This message is intended only for the named recipients. This message may contain information that is confidential or exempt from disclosure under applicable law. Any dissemination or copying of this message by anyone other than a named recipient is strictly prohibited. If you are not a named recipient or an employee or agent responsible for delivering this message to a named recipient, please notify us immediately, and permanently destroy this message and any copies you may have. Warning: Email may not be secure unless properly encrypted.


More information about the kallithea-general mailing list