ramkrishanbhatt / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

Order of WSGIDaemonProcess and User/Group directives. #40

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If WSGIDaemonProcess directive appears in Apache configuration before the
User/Group directives, the value for uid/gid of Apache process will not yet
be set and will find default of -1/-1. This will result in daemon process
changing to uid/gid of -1/-1, which may subsequently cause child process
initialisation code to crash in Python setup somewhere due to lack of
permissions or some other problem with Python not liking the user/group
that process is running as.

Setup code may have to record whether user/group options to
WSGIDaemonProcess were set, and if not, then only lookup values
corresponding to User/Group after configuration has all been processed.

Interim work around is to always ensure that User/Group come before
WSGIDaemonProcess in Apache configuration files.

Original issue reported on code.google.com by Graham.Dumpleton@gmail.com on 21 Oct 2007 at 5:31

GoogleCodeExporter commented 8 years ago
As a user, I would be okay with mod_wsgi causing a configuration file error if
WSGIDaemonProcess is before User/Group, if that is easier to implement.

Original comment by brian@briansmith.org on 16 Jan 2008 at 1:27

GoogleCodeExporter commented 8 years ago
The original problem is relatively easy to fix. Since the likely hood of it 
happening in the first place was quite 
rare, I just couldn't be bothered fixing it at the time.

Original comment by Graham.Dumpleton@gmail.com on 16 Jan 2008 at 5:28

GoogleCodeExporter commented 8 years ago
An example of error messages from Apache error log (with LogLevel at info), 
which are an indicator of this problem are:

[Sat Jan 10 12:42:46 2009] [info] mod_wsgi: Initializing Python.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12757): Starting process 
'mysite.com' with uid=4294967295, gid=4294967295 and threads=15.
[Sat Jan 10 12:42:46 2009] [alert] mod_wsgi (pid=12757): Unable to determine 
home directory for uid=4294967295.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12758): Starting process 
'mysite.com' with uid=4294967295, gid=4294967295 and threads=15.
[Sat Jan 10 12:42:46 2009] [alert] mod_wsgi (pid=12758): Unable to determine 
home directory for uid=4294967295.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12759): Attach interpreter ''.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12760): Attach interpreter ''.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12761): Attach interpreter ''.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12762): Attach interpreter ''.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12763): Attach interpreter ''.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12764): Attach interpreter ''.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12765): Attach interpreter ''.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12766): Attach interpreter ''.
[Sat Jan 10 12:42:46 2009] [notice] Apache/2.2.6 (Unix) DAV/2 PHP/5.1.6 
mod_ssl/2.2.6 OpenSSL/0.9.8b SVN/1.5.1 mod_wsgi/2.3 Python/2.4.4 
mod_perl/2.0.2 Perl/v5.8.8 configured -- resuming normal operations
[Sat Jan 10 12:42:46 2009] [info] Server built: Sep 18 2007 11:25:59
[Sat Jan 10 12:42:46 2009] [notice] child pid 12757 exit signal Segmentation 
fault (11)
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12757): Process 'mysite.com' 
has died, restarting.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12767): Starting process 
'mysite.com' with uid=4294967295, gid=4294967295 and threads=15.
[Sat Jan 10 12:42:46 2009] [alert] mod_wsgi (pid=12767): Unable to determine 
home directory for uid=4294967295.
[Sat Jan 10 12:42:46 2009] [notice] child pid 12758 exit signal Segmentation 
fault (11)
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12758): Process 'mysite.com' 
has died, restarting.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12768): Starting process 
'mysite.com' with uid=4294967295, gid=4294967295 and threads=15.
[Sat Jan 10 12:42:46 2009] [alert] mod_wsgi (pid=12768): Unable to determine 
home directory for uid=4294967295.
[Sat Jan 10 12:42:46 2009] [notice] child pid 12767 exit signal Segmentation 
fault (11)
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12767): Process 'mysite.com' 
has died, restarting.
[Sat Jan 10 12:42:46 2009] [info] mod_wsgi (pid=12769): Starting process 
'mysite.com' with uid=4294967295, gid=4294967295 and threads=15.
[Sat Jan 10 12:42:46 2009] [notice] child pid 12768 exit signal Segmentation 
fault (11)

That uid/gid being (-1) and unable to determine home directory.

Original comment by Graham.Dumpleton@gmail.com on 11 Jan 2009 at 12:09

GoogleCodeExporter commented 8 years ago
For future reference (and findability), the error in your apache error_log will 
read
something like: 

[alert] mod_wsgi (pid=24962): Unable to determine home directory for uid=-1.

Original comment by jeff.ham...@gmail.com on 29 Jan 2009 at 10:00

GoogleCodeExporter commented 8 years ago
As was shown in more comprehensive log above, but yes that is believed to be 
the key message. The value of 
the uid may be -1 as signed or unsigned value.

Original comment by Graham.Dumpleton@gmail.com on 30 Jan 2009 at 1:21

GoogleCodeExporter commented 8 years ago
Fix in revision 1180 of trunk (3.0).

Original comment by Graham.Dumpleton@gmail.com on 6 Feb 2009 at 1:58

GoogleCodeExporter commented 8 years ago
Backported to mod_wsgi 2.X branch for 2.4 in revision 1235.

Original comment by Graham.Dumpleton@gmail.com on 16 Mar 2009 at 9:37

GoogleCodeExporter commented 8 years ago
Version 2.4 of mod_wsgi now released.

Original comment by Graham.Dumpleton@gmail.com on 11 Apr 2009 at 10:25