You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jeff Trawick <tr...@gmail.com> on 2010/04/09 14:39:34 UTC

Re: [mod_fcgid] Windows and TCP/IP

On Wed, Mar 31, 2010 at 10:56 AM, Darren Garvey <da...@gmail.com> wrote:
> On 31 March 2010 15:49, Jeff Trawick <tr...@gmail.com> wrote:
>>
>> On Wed, Mar 31, 2010 at 7:05 AM, William A. Rowe Jr.
>> <wr...@rowe-clan.net> wrote:
>> > On 3/31/2010 5:41 AM, Jeff Trawick wrote:
>> >> On Wed, Mar 31, 2010 at 6:26 AM, Darren Garvey
>> >> <da...@gmail.com> wrote:
>>
>> >>> I can't remember now if mod_fcgid used to support external FastCGI
>> >>> daemons
>> >>> or not, but mod_fastcgi did (via. FastCgiExternalServer IIRC).
>> >>
>> >> No; mod_fcgid only supports FastCGI app processes which it has spawned.
>> >>
>> >>>
>> >>> Does anyone know if there is any other way to communicate with
>> >>> mod_fcgid on
>> >>> Windows besides anonymous pipes?
>> >
>> > Isn't httpd 2.3 alpha mod_proxy_scgi ment to do this?
>>
>> mod_proxy_fcgi at least ;)  (I meant to add that earlier)
>>
>> mod_proxy_* is httpd's way to route/loadbalance/manage connections to
>> externally managed servers of various types
>
> Ahh, this might be what I'm looking for. Is
> http://mproxyfcgi.sourceforge.net/ the same thing? It looks like
> mod_proxy_fcgi is in trunk now but this link has a user guide. :)

hmmm, looks like the same idea (hopefully that's a good sign)...
mod_proxy_fcgid in httpd trunk was started from scratch some 4 yrs
ago...

> Does mod_proxy_fcgi set FCGI_WEB_SERVER_ADDRS as per the FastCGI spec?

That should be set when the TCP-based FastCGI application is spawned
and checked when a new connection from the web server/gateway is
accepted?

I see PHP logic to check it, but spawn-fcgi (Lighttpd) and fcgistarter
(httpd) don't handle that automatically.  (I think you'd need to
create a wrapper for your app that sets it, then tell
spawn-fcgi/fcgistarter/whatever to run the wrapper.)

Re: Dynamic reconfiguration max-clients.

Posted by Eric Covener <co...@gmail.com>.
On Sat, Apr 17, 2010 at 7:28 AM, Damian Lęcznar
<da...@gmail.com> wrote:
>  Hello,
> I have such strange question whether it is possible to dynamically
> reconfigure parameter max-clients without breaking the connection? Do you
> have some ideas as done in apache, I was very grateful.
> Best regards

This is a question for the users list, not the development list:

http://httpd.apache.org/userslist.html

(You can raise MaxClients up to the current ServerLimit during a
graceful restart)

-- 
Eric Covener
covener@gmail.com

Dynamic reconfiguration max-clients.

Posted by Damian Lęcznar <da...@gmail.com>.
  Hello,
I have such strange question whether it is possible to dynamically 
reconfigure parameter max-clients without breaking the connection? Do 
you have some ideas as done in apache, I was very grateful.
Best regards

Re: [mod_fcgid] Windows and TCP/IP

Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, Apr 14, 2010 at 1:52 PM, Jeff Trawick <tr...@gmail.com> wrote:
> On Fri, Apr 9, 2010 at 9:49 AM, Darren Garvey <da...@gmail.com> wrote:
>> On 9 April 2010 13:39, Jeff Trawick <tr...@gmail.com> wrote:
>>>
>>> On Wed, Mar 31, 2010 at 10:56 AM, Darren Garvey <da...@gmail.com>
>>> wrote:
>>> > On 31 March 2010 15:49, Jeff Trawick <tr...@gmail.com> wrote:
>>> >>
>>> >> On Wed, Mar 31, 2010 at 7:05 AM, William A. Rowe Jr.
>>> >> <wr...@rowe-clan.net> wrote:
>>> >> > On 3/31/2010 5:41 AM, Jeff Trawick wrote:
>>> >> >> On Wed, Mar 31, 2010 at 6:26 AM, Darren Garvey
>>> >> >> <da...@gmail.com> wrote:
>>>
>>> >> >>> Does anyone know if there is any other way to communicate with
>>> >> >>> mod_fcgid on Windows besides anonymous pipes?
>>>
>>> >> > Isn't httpd 2.3 alpha mod_proxy_scgi ment to do this?
>>>
>>> >> mod_proxy_fcgi at least ;)  (I meant to add that earlier)
>>> >>
>>> >> mod_proxy_* is httpd's way to route/loadbalance/manage connections to
>>> >> externally managed servers of various types
>>>
>>> > Ahh, this might be what I'm looking for. Is
>>> > http://mproxyfcgi.sourceforge.net/ the same thing? It looks like
>>> > mod_proxy_fcgi is in trunk now but this link has a user guide. :)
>>>
>>> hmmm, looks like the same idea (hopefully that's a good sign)...
>>> mod_proxy_fcgid in httpd trunk was started from scratch some 4 yrs
>>> ago...
>>
>> Ok so, does mod_proxy_fcgid in trunk work? It would be nice to test my
>> FastCGI code with an external configuration (with async I/O) on Windows. For
>> now I'm just using pipes which - apart from blocking on read/write - seem to
>> work fine.
>
> Does it work?  Well, sort of...
>
> Here's my first attempt:
>
> $ cat ~/inst/23/conf/conf.d/proxy-fcgi.conf
> ProxyPass /info fcgi://127.0.0.1:9999/
>
> $ support/fcgistarter -c ~/myhg/apache/fcgid/apps/info.pl -p 9999
>
> (uh, fcgidstarter needed a fix to work on my system)
>
> $ cat ~/myhg/apache/fcgid/apps/info.pl
> #!/usr/bin/perl
>
> use strict;
> use CGI::Fast;
>
> my $count = 0;
> while (my $q = CGI::Fast->new) {
>    print("Content-Type: text/plain\n\n");
>    print("Process ID: $$; Count is: " . ++$count . "\n");
>
>    print "VHOST: $ENV{'VHOST'}\n";
>    print "WHO: $ENV{'WHO'}\n";
>    print "User-AgenT: $ENV{'User_AgenT'}\n";
> }
>
> It worked for a few requests, after which the Perl FastCGI engine got
> out of sync and blocked in read().
>
> Perhaps others have had better results?  (Yeah, I should shut up and
> find the problem.)

Proxy holds open the back-end connection by default, so that it
doesn't have to reconnect when the same httpd child process needs to
send the app a request.  I have a single instance, single threaded
FastCGI app, effectively waiting for a subsequent request on that
held-open back-end connection, which won't happen until the same httpd
child process handles another request.

Disabling reuse resolves that problem:

ProxyPass /info fcgi://127.0.0.1:9999/ disablereuse=on

Re: [mod_fcgid] Windows and TCP/IP

Posted by Jeff Trawick <tr...@gmail.com>.
On Fri, Apr 9, 2010 at 9:49 AM, Darren Garvey <da...@gmail.com> wrote:
> On 9 April 2010 13:39, Jeff Trawick <tr...@gmail.com> wrote:
>>
>> On Wed, Mar 31, 2010 at 10:56 AM, Darren Garvey <da...@gmail.com>
>> wrote:
>> > On 31 March 2010 15:49, Jeff Trawick <tr...@gmail.com> wrote:
>> >>
>> >> On Wed, Mar 31, 2010 at 7:05 AM, William A. Rowe Jr.
>> >> <wr...@rowe-clan.net> wrote:
>> >> > On 3/31/2010 5:41 AM, Jeff Trawick wrote:
>> >> >> On Wed, Mar 31, 2010 at 6:26 AM, Darren Garvey
>> >> >> <da...@gmail.com> wrote:
>>
>> >> >>> Does anyone know if there is any other way to communicate with
>> >> >>> mod_fcgid on Windows besides anonymous pipes?
>>
>> >> > Isn't httpd 2.3 alpha mod_proxy_scgi ment to do this?
>>
>> >> mod_proxy_fcgi at least ;)  (I meant to add that earlier)
>> >>
>> >> mod_proxy_* is httpd's way to route/loadbalance/manage connections to
>> >> externally managed servers of various types
>>
>> > Ahh, this might be what I'm looking for. Is
>> > http://mproxyfcgi.sourceforge.net/ the same thing? It looks like
>> > mod_proxy_fcgi is in trunk now but this link has a user guide. :)
>>
>> hmmm, looks like the same idea (hopefully that's a good sign)...
>> mod_proxy_fcgid in httpd trunk was started from scratch some 4 yrs
>> ago...
>
> Ok so, does mod_proxy_fcgid in trunk work? It would be nice to test my
> FastCGI code with an external configuration (with async I/O) on Windows. For
> now I'm just using pipes which - apart from blocking on read/write - seem to
> work fine.

Does it work?  Well, sort of...

Here's my first attempt:

$ cat ~/inst/23/conf/conf.d/proxy-fcgi.conf
ProxyPass /info fcgi://127.0.0.1:9999/

$ support/fcgistarter -c ~/myhg/apache/fcgid/apps/info.pl -p 9999

(uh, fcgidstarter needed a fix to work on my system)

$ cat ~/myhg/apache/fcgid/apps/info.pl
#!/usr/bin/perl

use strict;
use CGI::Fast;

my $count = 0;
while (my $q = CGI::Fast->new) {
    print("Content-Type: text/plain\n\n");
    print("Process ID: $$; Count is: " . ++$count . "\n");

    print "VHOST: $ENV{'VHOST'}\n";
    print "WHO: $ENV{'WHO'}\n";
    print "User-AgenT: $ENV{'User_AgenT'}\n";
}

It worked for a few requests, after which the Perl FastCGI engine got
out of sync and blocked in read().

Perhaps others have had better results?  (Yeah, I should shut up and
find the problem.)

>>
>> > Does mod_proxy_fcgi set FCGI_WEB_SERVER_ADDRS as per the FastCGI spec?
>>
>> That should be set when the TCP-based FastCGI application is spawned
>> and checked when a new connection from the web server/gateway is
>> accepted?
>>
>> I see PHP logic to check it, but spawn-fcgi (Lighttpd) and fcgistarter
>> (httpd) don't handle that automatically.  (I think you'd need to
>> create a wrapper for your app that sets it, then tell
>> spawn-fcgi/fcgistarter/whatever to run the wrapper.)
>
> Yes, of course. Silly question now I think about it. This is an
> installation-specific configuration variable, I guess PassEnv should do too.

You'd want to set FCGI_WEB_SERVER_ADDRS as the FastCGI app process is
created, not during request context (PassEnv), since you're trying to
validate what happens in the request context.

Re: [mod_fcgid] Windows and TCP/IP

Posted by Darren Garvey <da...@gmail.com>.
On 9 April 2010 13:39, Jeff Trawick <tr...@gmail.com> wrote:

> On Wed, Mar 31, 2010 at 10:56 AM, Darren Garvey <da...@gmail.com>
> wrote:
> > On 31 March 2010 15:49, Jeff Trawick <tr...@gmail.com> wrote:
> >>
> >> On Wed, Mar 31, 2010 at 7:05 AM, William A. Rowe Jr.
> >> <wr...@rowe-clan.net> wrote:
> >> > On 3/31/2010 5:41 AM, Jeff Trawick wrote:
> >> >> On Wed, Mar 31, 2010 at 6:26 AM, Darren Garvey
> >> >> <da...@gmail.com> wrote:
>
> >> >>> Does anyone know if there is any other way to communicate with
> >> >>> mod_fcgid on Windows besides anonymous pipes?
>
> >> > Isn't httpd 2.3 alpha mod_proxy_scgi ment to do this?
>
> >> mod_proxy_fcgi at least ;)  (I meant to add that earlier)
> >>
> >> mod_proxy_* is httpd's way to route/loadbalance/manage connections to
> >> externally managed servers of various types
>
> > Ahh, this might be what I'm looking for. Is
> > http://mproxyfcgi.sourceforge.net/ the same thing? It looks like
> > mod_proxy_fcgi is in trunk now but this link has a user guide. :)
>
> hmmm, looks like the same idea (hopefully that's a good sign)...
> mod_proxy_fcgid in httpd trunk was started from scratch some 4 yrs
> ago...
>

Ok so, does mod_proxy_fcgid in trunk work? It would be nice to test my
FastCGI code with an external configuration (with async I/O) on Windows. For
now I'm just using pipes which - apart from blocking on read/write - seem to
work fine.


>  > Does mod_proxy_fcgi set FCGI_WEB_SERVER_ADDRS as per the FastCGI spec?
>
> That should be set when the TCP-based FastCGI application is spawned
> and checked when a new connection from the web server/gateway is
> accepted?
>
> I see PHP logic to check it, but spawn-fcgi (Lighttpd) and fcgistarter
> (httpd) don't handle that automatically.  (I think you'd need to
> create a wrapper for your app that sets it, then tell
> spawn-fcgi/fcgistarter/whatever to run the wrapper.)
>

Yes, of course. Silly question now I think about it. This is an
installation-specific configuration variable, I guess PassEnv should do too.

Thanks for your help.

Cheers,
Darren