httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Dumpleton <graham.dumple...@gmail.com>
Subject Re: mod_fcgid: different instances of the same program
Date Mon, 09 Nov 2009 23:05:24 GMT
2009/11/10 Jeff Trawick <trawick@gmail.com>:
> On Mon, Nov 9, 2009 at 5:16 PM, Danny Sadinoff <danny.sadinoff@gmail.com> wrote:
>> Here are two details of mod_fcgid process management that I've just
>> learned after a long debug session and squinting at the mod_fcgid
>> code.
>>
>> 1) symlinks & you.
>> It seems that mod_fcgid identifies fcgid programs by inode and device,
>> not by filename.  So two fcgid programs invoked by the webserver
>> along different paths will be counted as the same if the two paths are
>> hardlinks or softlinks to each other.
>
> Mostly yes.
>
> The path to the file doesn't matter; it is the file itself that matters.
>
> There are different requirements for how programs are distinguished.
> One possibility is changing from stat() to lstat() (i.e., distinguish
> symlinks but not hard links).  Another possibility is looking only at
> the basename.  This was discussed in this thread:
> http://www.mail-archive.com/dev@httpd.apache.org/msg45516.html

FWIW, in the mod_wsgi module for Python applications, by default
applications are distinguished based on mount point and host/port they
are running under. That is, combination of SERVER_HOST, SERVER_PORT
and SCRIPT_NAME values.

Well, actually it is a little bit more complicated than that because
ports 80/443 are treated effectively the same given usage would
normally be paired.

What it means is that can have one script file mounted multiple times
and for each to be treated as separate instance of application.

In mod_wsgi the separation by default is done based on Python sub
interpreters within a process rather than actual processes. This is
because mod_wsgi supports running in embedded mode, ie., within Apache
server child processes, or as distinct daemon processes like with
FASTCGI.

There is the flexibility in mod_wsgi though to override this however
and manually specific what named application group (Python sub
interpreter within process), or whether embedded or daemon mode used
for processes and if daemon mode which named daemon process group.

Anyway, thought the strategy of using SERVER_HOST, SERVER_PORT and
SCRIPT_NAME values may be of interest as an alternative to
distinguishing based on path to script.

Graham

Mime
View raw message