It is not recommended that /tmp/wsgi be used as socket prefix.
Directory they are in should only be writable by root. This is
documented in:
http://code.google.com/p/modwsgi/wiki/ConfigurationIssues#Location_Of_UNIX_Sockets
>> While writing a thumbnail service in Django I found the messages below
>> in the apache error log for the application. Has anybody ever seen
>> this before? Touching the Django .wsgi file didn't fix it only
>> restarting apache seemed to fix it.
>>
>> We are using mod_wsgi version 2.3
>>
>> ~Carl
>> ----------
>>
>> [Wed Oct 28 15:01:22 2009] [debug] mod_wsgi.c(8455): mod_wsgi
>> (pid=9449): Starting thread 4 in daemon process 'thumb'.
>> [Wed Oct 28 15:01:22 2009] [alert] (11)Resource temporarily
>> unavailable: mod_wsgi (pid=9449): Couldn't create worker thread 3 in
>> daemon process 'thumb'
Likely from:
pthread_create() will fail if:
[EAGAIN] The system lacked the necessary resources to create
another thread, or the system-imposed limit on the
total number of threads in a process
[PTHREAD_THREADS_MAX] would be exceeded.
This suggests threads per process, but since those threads are only
created on startup one wouldn't expect that unless there could be
other system wide limits that were being hit.
Graham
Even though the latter is not generally going to happen unless system
administrator acts without thinking, I should perhaps on any failure
actually kill the daemon process rather than carry on, because right
now could carry on as root.
Possibly better to not even check for
failure, but later on before initiating main loop that see if still
running as root for any reason and just kill off process.
Looking at this further, not sure there is an issue. At least not
anything one can do anything about.
The setuid() function will only fail if the uid is out of range.
What exactly that means is a bit vague but presumably that means a uid
outside of range of what system allows. It doesn't mean a uid for
which no account exists at the time. It looks like you can still
change to a uid even if no account exists matching that uid.
To even get that far in code the user given by 'user' option, whether
by name or by "#nnn" would already have been validated in various ways
and certainly know whether or not it was in valid range.
The real problem comes later as process crashes anyway. This can seem
to happen in various places, so my guess is that something caches
password file entry information or something and that gets invalidated
and later attempt to use it causes crash.
Anyway, seems that not much I can do about it. It is just a very nasty
thing to do, remove account while something wanting to run as that
user, and likely that a lot of programs aren't going to behave well.
Important thing is that process will not simply run as root.
Graham