[mod_python] mod_wsgi (pid=88536): Unable to change working directory

Graham Dumpleton graham.dumpleton at gmail.com
Tue Jan 12 17:55:08 EST 2010

2010/1/13 mog <lists at elasticmind.net>:
> On 12/01/2010 21:24, mog wrote:
>> Hi,
>> I'm seeing this error in my main Apache log when I switched to using
>> daemon mode:
>> [Tue Jan 12 21:13:47 2010] [alert] (2)No such file or directory: mod_wsgi
>> (pid=88536): Unable to change working directory to '/nonexistent'.
>> Not sure why it would be happening though, why mod_wsgi would need to
>> change directories, or what the "correct" solution is? If someone could
>> please point me in the right direction, it would be greatly appreciated.
>> Thanks,
>> mog
> I read that mod_wsgi's daemon mode is the way forward, so let's "make it
> so". It doesn't seem to want to play nicely though.
> The 'unable to change working directory' problems sort of go away if I
> specify 'WSGIDaemonProcess home=/root', but that just doesn't feel right to
> me. Is there something more appropriate I should be using for that?

By rights it perhaps shouldn't be an alert but a warning. You can ignore it.

It occurs because in daemon mode mod_wsgi will change working
directory to the home directory of the user that the daemon process
runs as. On your system, the default Apache user doesn't have a home
directory and so the message. It will not stop anything from working.

If you really want to get rid of it, then override home as you have
done, setting it to '/tmp' even. Alternatively, create a dedicated
user, or use another existing user account that does have a home
directory, specifying the user/group options to WSGIDaemonProcess so
that the daemon process runs as that user and not the default Apache

> My Apache vhost config is pretty normal with these WSGI specifics in:
>    WSGIDaemonProcess meow.elasticmind.net processes=1 threads=5 home=/root
> display-name=%{GROUP}
>    WSGIProcessGroup meow.elasticmind.net
>    WSGIApplicationGroup %{GLOBAL}
>    WSGIScriptAlias / /home/test/trunk/test/test.wsgi
> These are all present inside the VirtualHost directive but not contained
> within any Directory directives etc.
> Unfortunately though, it doesn't seem happy with these things. The only
> error messages I'm seeing are these:
>    [error] Script timed out before returning headers: test.wsgi
> The content of test.wsgi is:
> def application(environ, start_response):
>    status = '200 OK'
>    output = 'Hello World!'
>    response_headers = [('Content-type', 'text/plain'),
>                        ('Content-Length', str(len(output)))]
>    start_response(status, response_headers)
>    return [output]
> So without the DaemonProcess process stuff, this works absolutely fine. With
> the daemon mode process stuff, it breaks :(

Are you still loading mod_python into same Apache?

You likely have a conflicting version of mod_python loaded which is
causing problems. Disable mod_python and try again.

Please use mod_wsgi list in future as I already pointed out.


More information about the Mod_python mailing list