From davidb at chelsea.net Tue Aug 5 13:15:48 2008 From: davidb at chelsea.net (David Birnbaum) Date: Tue, 5 Aug 2008 13:15:48 -0400 (EDT) Subject: [FASTCGI] Mailing List Repair Message-ID: Folks, The FastCGI mailing lists have been offline for a while due to a mail server crash. Mailman was kinda low on the list to get repaired, but it now has been. I apologize for the inconvience. Cheers, David. From davidb at pins.net Tue Aug 5 14:50:22 2008 From: davidb at pins.net (David Birnbaum) Date: Tue, 5 Aug 2008 14:50:22 -0400 (EDT) Subject: [FASTCGI] List Repair Message-ID: Folks, The FastCGI lists have been down for a while due to a mail problem. I apologize for the length of time it's taken to get them back up. They should be functional again, although you may have to reset your password or other settings. Cheers, David. From tom at streamsense.net Tue Aug 5 14:56:11 2008 From: tom at streamsense.net (Thomas Grimshaw) Date: Tue, 05 Aug 2008 19:56:11 +0100 Subject: [FASTCGI] FCGI_LISTENSOCK_FILENO Message-ID: <4898A24B.3030408@streamsense.net> Since the list is working again now :) =========== Hi all, I'm currently in the process of expanding my webserver to support FastCGI. However, i'm having a little trouble understanding one crucial part of the specification. I may be lacking some fundamental knowledge here, so, please bear with me! I need to create a socket in my webserver application before launching the fastCGI app. So, I do this, and I have the socket handle. The specification reads "The Web server leaves a single file descriptor, FCGI_LISTENSOCK_FILENO, open when the application begins execution. This descriptor refers to a listening socket created by the Web server." How does the FastCGI application get my socket handle? I see from the spec that FCGI_LISTENSOCK_FILENO is a constant of 0. And a file descriptor of 0 refers to STDIN, does it not? Is this a roundabout way of saying that I need to use STDIN to communicate? I'd appreciate any help you guys can give. Many thanks, Tom From rainer.jung at kippdata.de Tue Aug 5 18:39:05 2008 From: rainer.jung at kippdata.de (Rainer Jung) Date: Wed, 06 Aug 2008 00:39:05 +0200 Subject: [FASTCGI] [Patch] Improve handling of interrupted system calls Message-ID: <4898D689.10803@kippdata.de> Hello, during stress tests we realized, that mod_fastcgi aborts requests in some cases, where the root cause is an interrupted system call. After adding a retry functionality, we noticed no more of these errors and the responses were delivered with the correct content. So I attach the patch we used. Some comments: There are two situations, that are handled by the patch: A) After select() in socket_io() indicates, that the response can be read, but the following readv() in fcgi_buf_socket_recv() returns with EAGAIN. Normally this should not happen, but it isn't forbidden and at least on AIX 5.2 we noticed exactly this behaviour. It only showed up sporadically, but when it happens, because mod_fastcgi aborts the request we get status codes 500. B) select() in socket_io() can return with EINTR. We implemented a retry loop, which sleep 1 second and loops max 10 times in order to prevent a non terminating loop. We also noticed this behaviour on AIX 5.2 under stress (sporadically). The loop never ran more than twice. The one second sleep might not be ideal, but since the problem only happens very rarely, it looked safer, than a shorter sleep. Thanks for producing mod_fastcgi! Regards, Rainer -------------- next part -------------- A non-text attachment was scrubbed... Name: mod_fastcgi.c.patch Type: text/x-patch Size: 1759 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mod_fastcgi.h.patch Type: text/x-patch Size: 591 bytes Desc: not available URL: From rainer.jung at kippdata.de Tue Aug 5 18:45:15 2008 From: rainer.jung at kippdata.de (Rainer Jung) Date: Wed, 06 Aug 2008 00:45:15 +0200 Subject: [FASTCGI] [Patch] Improve handling of interrupted system calls In-Reply-To: <4898D689.10803@kippdata.de> References: <4898D689.10803@kippdata.de> Message-ID: <4898D7FB.4030007@kippdata.de> Since the attachments were scrubbed in the web archive display, here's a download link to the two files: http://people.apache.org/~rjung/mod_fastcgi/patches/interrupted_syscall/ From davidb at pins.net Tue Aug 5 20:58:54 2008 From: davidb at pins.net (David Birnbaum) Date: Tue, 05 Aug 2008 20:58:54 -0400 Subject: [FASTCGI] FCGI_LISTENSOCK_FILENO In-Reply-To: <4898A24B.3030408@streamsense.net> References: <4898A24B.3030408@streamsense.net> Message-ID: <4898F74E.2070300@pins.net> Tom, If the webserver forks the application, it leaves FD0, and STDERR, STDIN, and STDOUT are mutiplexed over it using the FastCGI protocol. If it's a socket connect, it's basically the same thing - you'll to an accept(), and when you get the FD, use the libraries to send/receive data on the socked. David. ------------------------------------------------------------------------ Thomas Grimshaw wrote: > Since the list is working again now :) > > =========== > > > Hi all, > > I'm currently in the process of expanding my webserver to support > FastCGI. However, i'm having a little trouble understanding one > crucial part of the specification. > > I may be lacking some fundamental knowledge here, so, please bear with > me! > > I need to create a socket in my webserver application before launching > the fastCGI app. So, I do this, and I have the socket handle. > > The specification reads "The Web server leaves a single file > descriptor, FCGI_LISTENSOCK_FILENO, open when the application begins > execution. This descriptor refers to a listening socket created by the > Web server." > How does the FastCGI application get my socket handle? I see from the > spec that FCGI_LISTENSOCK_FILENO is a constant of 0. And a file > descriptor of 0 refers to STDIN, does it not? Is this a roundabout way > of saying that I need to use STDIN to communicate? > > I'd appreciate any help you guys can give. > > Many thanks, > > Tom > > > > _______________________________________________ > FastCGI-developers mailing list > FastCGI-developers at mailman.fastcgi.com > http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers -------------- next part -------------- An HTML attachment was scrubbed... URL: From cdp_xe at gmx.net Wed Aug 6 04:13:21 2008 From: cdp_xe at gmx.net (Steffen Wendzel) Date: Wed, 6 Aug 2008 10:13:21 +0200 Subject: [FASTCGI] apache restart Message-ID: <20080806101321.cb527bdf.cdp_xe@gmx.net> hi, since the list is up again, I will try to post my question again. I develop a fastcgi based application but after I made a few requests I have to restart the apache using /etc/init.d/apache2 force-reload to be able to replace the old executable with the old one. Example: $ sudo cp test2.fcgi /usr/lib/cgi-bin/test2.fcgi cp: regular file "/usr/lib/cgi-bin/test2.fcgi": Text file busy $ sudo /etc/init.d/apache2 force-reload $ sleep 2 <-- takes at least two seconds $ sudo cp test2.fcgi /usr/lib/cgi-bin/test2.fcgi <-- now works fine Do you have any solutions how to optimize this? regards Steffen Wendzel From davidb at pins.net Wed Aug 6 10:20:38 2008 From: davidb at pins.net (David Birnbaum) Date: Wed, 6 Aug 2008 10:20:38 -0400 (EDT) Subject: [FASTCGI] apache restart In-Reply-To: <20080806101321.cb527bdf.cdp_xe@gmx.net> References: <20080806101321.cb527bdf.cdp_xe@gmx.net> Message-ID: Steffen, You're trying to overwrite, and the OS has it locked. Maybe you can rename it: mv /usr/lib/cgi-bin/test2.fcgi /usr/lib/cgi-bin/test2.fcgi.bak cp test2.fcgi /usr/lib/cgi-bin/test2.fcgi [ kill test2.fcgi process or whatever ] rm /usr/lib/cgi-bin/test2.fcgi.bak David. ----- On Wed, 6 Aug 2008, Steffen Wendzel wrote: > hi, > > since the list is up again, I will try to post my question again. > > I develop a fastcgi based application but after I made a few requests I have > to restart the apache using > > /etc/init.d/apache2 force-reload > > to be able to replace the old executable with the old one. > > Example: > > $ sudo cp test2.fcgi /usr/lib/cgi-bin/test2.fcgi > cp: regular file "/usr/lib/cgi-bin/test2.fcgi": Text file busy > $ sudo /etc/init.d/apache2 force-reload > $ sleep 2 <-- takes at least two seconds > $ sudo cp test2.fcgi /usr/lib/cgi-bin/test2.fcgi <-- now works fine > > Do you have any solutions how to optimize this? > > regards > Steffen Wendzel > > _______________________________________________ > FastCGI-developers mailing list > FastCGI-developers at mailman.fastcgi.com > http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers > From bryan at arcamax.com Thu Aug 7 07:32:22 2008 From: bryan at arcamax.com (Bryan White) Date: Thu, 07 Aug 2008 07:32:22 -0400 Subject: [FASTCGI] apache restart In-Reply-To: References: <20080806101321.cb527bdf.cdp_xe@gmx.net> Message-ID: <489ADD46.7080500@arcamax.com> David Birnbaum wrote: > Steffen, > > You're trying to overwrite, and the OS has it locked. Maybe you can > rename it: > > mv /usr/lib/cgi-bin/test2.fcgi /usr/lib/cgi-bin/test2.fcgi.bak > cp test2.fcgi /usr/lib/cgi-bin/test2.fcgi > [ kill test2.fcgi process or whatever ] > rm /usr/lib/cgi-bin/test2.fcgi.bak > > David. A strategy I have used that has worked well is to have the application keep track of the timestamp on its executable file. When the time stamp changes, exit. I do the check before handling each request. It might be better to do it after the request, but that might cause problems being sure you are running the latest version in a compile and test cycle. Then to roll out a new version I do: mv prog prog.old; mv prog.new prog The first method has the advantage of being able to undo the change if it goes horribly wrong. This works as well: rm prog; mv prog.new prog This works because Linux maintains a link to the file as long as it is executing. The disk space is not recovered until exit. This also works beautifully in a gcc compile and test cycle because gcc removes the old one before creating the new one. -- Bryan White From webmaster at cosmicperl.com Thu Aug 7 12:17:56 2008 From: webmaster at cosmicperl.com (Lyle) Date: Thu, 07 Aug 2008 17:17:56 +0100 Subject: [FASTCGI] List Repair In-Reply-To: References: Message-ID: <489B2034.4080503@cosmicperl.com> David Birnbaum wrote: > Folks, > > The FastCGI lists have been down for a while due to a mail problem. I > apologize for the length of time it's taken to get them back up. They > should be functional again, although you may have to reset your > password or other settings. > > Cheers, > > David. Hi David, Thought I hadn't had any FastCGI emails for a while... By the way I've been held up the last 6 months on a big software project that has taken up all of my time. I'm finally getting to the stage where I'm incorporating FastCGI on Linux/Apache Linux/Lighttpd Windows/IIS Windows/Apache Windows/Lighttpd I'll be working through and writing guides for each on setting up the server with FastCGI then writing scripts in Perl that'll work across all of them. Wish me luck :) Lyle From davidb at pins.net Fri Aug 8 14:56:50 2008 From: davidb at pins.net (David Birnbaum) Date: Fri, 8 Aug 2008 14:56:50 -0400 (EDT) Subject: [FASTCGI] [Patch] Improve handling of interrupted system calls In-Reply-To: <4898D7FB.4030007@kippdata.de> References: <4898D689.10803@kippdata.de> <4898D7FB.4030007@kippdata.de> Message-ID: I sent a note off to Rob...I'll see if he can bless this one and take a look at the other open patches that are out there. Thanks for the contribution. David. ----- On Wed, 6 Aug 2008, Rainer Jung wrote: > Since the attachments were scrubbed in the web archive display, here's a > download link to the two files: > > http://people.apache.org/~rjung/mod_fastcgi/patches/interrupted_syscall/ > _______________________________________________ > FastCGI-developers mailing list > FastCGI-developers at mailman.fastcgi.com > http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers > From niro at tut.by Mon Aug 11 02:40:49 2008 From: niro at tut.by (Michael Borisov) Date: Mon, 11 Aug 2008 09:40:49 +0300 Subject: [FASTCGI] Show image Message-ID: <1218436850.30946.1.camel@niro-laptop> Hi All! I try to show some image(png,jpg,gif) with fastcgi? Simple CGI example works fine: #include #include using namespace std; int main(){ ? printf("Content-type: image/gif\r\n"); ? printf("\r\n"); ? ifstream in("../image.gif"); ? if (!in) return 1; ? char buf; ? buf = in.get(); ? while (in){ ? ? printf("%c",buf); ? ? buf = in.get(); } in.close(); return 0; } FCGI example don't works: #include #include "fcgi_stdio.h" using namespace std; int main(){ while(FCGI_Accept() >= 0) { printf("Content-type: image/gif\r\n"); printf("\r\n"); ifstream in("../image.gif"); if (!in) return 1; char buf; buf = in.get(); while (in){ printf("%c",buf); buf = in.get(); } in.close(); } return 0; } What wrong with that code ? apache2 2.2.3-4+etch4 libapache2-mod-fastcgi 2.4.2-8 libfcgi0c2 2.4.0-6 From bryan at arcamax.com Mon Aug 11 06:38:38 2008 From: bryan at arcamax.com (Bryan White) Date: Mon, 11 Aug 2008 06:38:38 -0400 Subject: [FASTCGI] Show image In-Reply-To: <1218436850.30946.1.camel@niro-laptop> References: <1218436850.30946.1.camel@niro-laptop> Message-ID: <48A016AE.8030103@arcamax.com> Michael Borisov wrote: > Hi All! > I try to show some image(png,jpg,gif) with fastcgi? > > ifstream in("../image.gif"); Are you sure that the current directory is what you think it is? -- Bryan White From niro at tut.by Mon Aug 11 11:45:22 2008 From: niro at tut.by (Michael Borisov) Date: Mon, 11 Aug 2008 18:45:22 +0300 Subject: [FASTCGI] Show image In-Reply-To: <48A016AE.8030103@arcamax.com> References: <1218436850.30946.1.camel@niro-laptop> <48A016AE.8030103@arcamax.com> Message-ID: <1218469522.15293.4.camel@niro-laptop> > > > > ifstream in("../image.gif"); > > Are you sure that the current directory is what you think it is? > Nothing change if I shall write full path to file. From dister.kemp at gmail.com Mon Aug 18 08:10:08 2008 From: dister.kemp at gmail.com (Dister Kemp) Date: Mon, 18 Aug 2008 17:40:08 +0530 Subject: [FASTCGI] List Repair In-Reply-To: <489B2034.4080503@cosmicperl.com> References: <489B2034.4080503@cosmicperl.com> Message-ID: <7378d0a90808180510x284ed01el6e26697022e25ca@mail.gmail.com> Lyle, continue the good work pal. Good luck ! Hope you start with Windows/IIS first ! On Thu, Aug 7, 2008 at 9:47 PM, Lyle wrote: > David Birnbaum wrote: > >> Folks, >> >> The FastCGI lists have been down for a while due to a mail problem. I >> apologize for the length of time it's taken to get them back up. They >> should be functional again, although you may have to reset your password or >> other settings. >> >> Cheers, >> >> David. >> > > Hi David, > Thought I hadn't had any FastCGI emails for a while... > > By the way I've been held up the last 6 months on a big software project > that has taken up all of my time. I'm finally getting to the stage where I'm > incorporating FastCGI on Linux/Apache > Linux/Lighttpd > Windows/IIS > Windows/Apache > Windows/Lighttpd > > > I'll be working through and writing guides for each on setting up the > server with FastCGI then writing scripts in Perl that'll work across all of > them. > > Wish me luck :) > > > Lyle > > > _______________________________________________ > FastCGI-developers mailing list > FastCGI-developers at mailman.fastcgi.com > http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sxk1969 at hotmail.com Mon Aug 18 17:00:53 2008 From: sxk1969 at hotmail.com (Saikat Kanjilal) Date: Mon, 18 Aug 2008 14:00:53 -0700 Subject: [FASTCGI] Fastcgi C++ error on Apache and windows Message-ID: Hello Folks: I have written a fascgi client using c++ and the fcgiapp module. I am using Apache 2.0.63 as my webserver and Windows Server 2003 Web Edition as my operating system. Our load testing environment consists of Linux Hosts running Windows Server 2003 Virtual Machines with this fastcgi c++ client. Unfortunately I had to use windows due to the fact that one of the libraries was only available on windows. Anyways during the last set of load tests I see the following error intermittently in the Apache logs: Incomplete headers (0 bytes) received from server followed by my servername (i.e. the fastcgi client). I have searched the web and did not see any solutions to this problem except for implementing my own signal handler which I don't really wish to do: I am attaching parts of the code here for reference: int main(int argc, char*const argv[] ) { try { //create an input output and an error stream //listen on a socket with an appropriate backlog //exit if the socket is unable to be opened //if the request currently needs to be initialized exit std::string port=":9000"; std::string listenQueueBacklog=400; FCGX_Stream *in, *out, *err; FCGX_ParamArray envp; if (FCGX_Init()) exit(1); int listen_socket = FCGX_OpenSocket(port.c_str(), atoi(listenQueBacklog.c_str())); if (listen_socket < 0) exit(1); FCGX_Request request; if (FCGX_InitRequest(&request, listen_socket, 0)) exit(1); while (FCGX_Accept(&in, &out, &err, &envp) >= 0) { //print out the content type and retrieve the query string //which is everything after the question mark in the URL FCGX_FPrintF(out,"Content-type: text/html\r\nStatus: 200 OK\r\n\r\n"); //main part of the code goes here .......... } //end while (FCGX_Accept(&in, &out, &err, &envp) >= 0) }//end try block catch (std::exception& ex) { } return 0; } Note that this code only displays the Incomplete headers error during load testing, whats worse is that when the environment for load testing is slightly different (meaning using less virtual machines per host) we dont see this error anymore. I would really appreciate some help with this issue. Thanks Again _________________________________________________________________ Get thousands of games on your PC, your mobile phone, and the web with Windows®. http://clk.atdmt.com/MRT/go/108588800/direct/01/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From eddie.bishop at gmail.com Mon Aug 18 18:48:42 2008 From: eddie.bishop at gmail.com (Eddie Bishop) Date: Mon, 18 Aug 2008 16:48:42 -0600 Subject: [FASTCGI] obtaining a core file Message-ID: Hi all, I'm developing an application that runs under fastcgi on linux/apache. The application crashes at seemingly random times (I don't think it's fastcgi's fault). I don't know how to duplicate the problem, so I need to be able to setup the application to generate a core file, so that when it happens again, I can debug the core file. I can't debug the issue outside of fastcgi (in a development environment), becuase I don't know how to reproduce the issue. So the plan is to set it up to dump a core file next time it happens in production. How can I set this up, and where would the core file be dumped to? I know about the ulimit() function, but in my development environment (running outside of fastcgi) I couldn't get it to return anything besides 0. ( see http://www.opengroup.org/onlinepubs/009695399/functions/ulimit.html ) Ideally, I'd like a solution that doesn't require me to build fastcgi again. In other words, I'd like a fix that only needs me to edit the source of my app and not the source of fastcgi. Thanks, Eddie -------------- next part -------------- An HTML attachment was scrubbed... URL: From sprog at online.ru Sat Aug 23 08:57:06 2008 From: sprog at online.ru (Igor) Date: Sat, 23 Aug 2008 16:57:06 +0400 Subject: [FASTCGI] Fastcgi C++ error on Apache and windows In-Reply-To: References: Message-ID: <101705567.20080823165706@online.ru> An HTML attachment was scrubbed... URL: From sprog at online.ru Mon Aug 25 15:03:18 2008 From: sprog at online.ru (Igor) Date: Mon, 25 Aug 2008 23:03:18 +0400 Subject: [FASTCGI] Fastcgi C++ error on Apache and windows, corrections Message-ID: <676113457.20080825230318@online.ru> Hello All, It seems that I've been wrong about worker.c, worker.c is not a default mpm on windows but rather mpm_winnt. Instead of giving advises on tuning worker.c parameters for win32 I should have advised mpm_winnt's parameters which are a bit limited. Actually mpm_winnt's ThreadsPerChild is the only parameter which can make difference. The mpm config for win32 should look like ThreadsPerChild 600 MaxRequestsPerChild 0 > Check our your test environment's worker.c setup. > > > > The issue you described is related to either FastCGI load balancer or your Apache2 thread manager. > I would go to worker.c first. By default the worker.c (on windows that is the only supported model) is set up to work > on a very powerless machine therefore the ServerLimit as well as MaxClients and MaxRequestsPerChild is configured to consume > less memory and CPU (about 3-5% of available modern servers). I wouldn't go into details describing how that affects your Fast CGI servers, > just remember - when you start performance test (max server load test) your Apache configuration should allow it to consume almost all server > resources. By default you're utilizing only 5% of your server, all the threads are consumed and you got incomplete header error while your > server load is only 5%. Change parameters in worker.c according to the resources available. Likely that config will be checked by a teenager first by sending > the server a numerous requests and seeing how it affects the server's ability to respond. Actually any server could be DOSed, but that is the whole another story. > Note that this code only displays the Incomplete headers error during load testing, whats worse is that when the environment for load testing is slightly different (meaning using less virtual machines per host) we dont see this error anymore. > That might happen because the less hosts you have the more threads are available. It's all in the worker.c. I recommend you to study how Apache2 is > utilizing available resources before running performance tests. Of course Apache has a built in load restrictions otherwise you would end up with a DOSed host that > you cannot access even via console. -- Best regards, Igor mailto:sprog at online.ru From jsprenkle at gmail.com Tue Aug 26 00:30:14 2008 From: jsprenkle at gmail.com (Jay Sprenkle) Date: Mon, 25 Aug 2008 23:30:14 -0500 Subject: [FASTCGI] apache 2.2+fastcgi+cgicc Message-ID: <1b5f39a10808252130g4104cccfodfb7d80048f4a241@mail.gmail.com> Good evening all, I'm trying to get a fastcgi+cgicc application working and I've run into a snag. I'm not sure if it's a bug or I'm using the code incorrectly. Any suggestions would be appreciated. Here's the setup: Apache 2.x (latest version, running on windows xp) is configured to start a single instance of my fastcgi application and communicate over a tcp connection. I picked a random port in the 9000 range. The application starts and I can trace it to the point in the fcgx initialization where it checks stdin/stdout/stderr (function os_libinit() ). The comments say "Determine if this library is being used to listen for FastCGI connections. This is communicated by STDIN containing a valid handle to a listener object". From the web server logs the fastcgi dll is loading my application but tt this point all of the streams return as valid. Here's the code from os_libinit(): if((GetStdHandle(STD_OUTPUT_HANDLE) == INVALID_HANDLE_VALUE) && (GetStdHandle(STD_ERROR_HANDLE) == INVALID_HANDLE_VALUE) && (GetStdHandle(STD_INPUT_HANDLE) != INVALID_HANDLE_VALUE) ) Is this a bug in the fastcgi dll/Apache or am I using it wrong? The next bit of code in the same function checks for an array passed by the initialization call. /* * If there are no stdioFds passed in, we're done. */ if(stdioFds == NULL) { libInitialized = 1; return 0; } Since it always passes null the return is executed. The initialization never calls accept() and never sets the listenType variable. The later calls to fcgx_accept() crash trying to read from the uninitialized web server ipc connection. Also, I plan to modify the library to time out on accept calls instead of blocking forever. I'd like for my fastcgi application to be able to perform maintenance tasks. I planned on detecting the accept() timeout and using that as a reasonable indication the system isn't busy and doesn't have any pending requests to process. I planned on using select() to determine if there were pending requests. Is there any interest in this code? I'd be happy to donate it to the project. Thanks for your time, Jay From Tom at tomdonovan.net Tue Aug 26 08:57:44 2008 From: Tom at tomdonovan.net (Tom Donovan) Date: Tue, 26 Aug 2008 08:57:44 -0400 Subject: [FASTCGI] apache 2.2+fastcgi+cgicc In-Reply-To: <1b5f39a10808252130g4104cccfodfb7d80048f4a241@mail.gmail.com> References: <1b5f39a10808252130g4104cccfodfb7d80048f4a241@mail.gmail.com> Message-ID: <48B3FDC8.6030302@tomdonovan.net> Jay Sprenkle wrote: > Good evening all, > > I'm trying to get a fastcgi+cgicc application working and I've run > into a snag. I'm not sure if it's a bug or I'm using the code > incorrectly. Any suggestions would be appreciated. > > Here's the setup: > Apache 2.x (latest version, running on windows xp) is configured to > start a single instance of my fastcgi application and communicate over > a tcp connection. I picked a random port in the 9000 range. > ... > > if((GetStdHandle(STD_OUTPUT_HANDLE) == INVALID_HANDLE_VALUE) && > (GetStdHandle(STD_ERROR_HANDLE) == INVALID_HANDLE_VALUE) && > (GetStdHandle(STD_INPUT_HANDLE) != INVALID_HANDLE_VALUE) ) > > Is this a bug in the fastcgi dll/Apache or am I using it wrong? > Apache 2.2.9 included APR 1.3, which introduced an incompatible change to the way processes are created on Windows. You will need to change mod_fastcgi and rebuild it for Apache 2.2.9 or higher. Starting with Apache 2.2.9, it is necessary to call apr_procattr_io_set() to correctly configure stdin, stdout, and stderr for fastcgi programs before calling apr_procattr_child_in_set(). Here is a patch to fcgi_pm.c which will make mod_fastcgi compatible with Apache 2.2.9+. The patch affects the WIN32 portion of fcgi_pm.c, as this problem is specific to Windows. -tom- --- fcgi_pm.c 2004-04-14 22:01:26.000000000 -0400 +++ fcgi_pm.c 2008-08-26 08:22:15.856008700 -0400 @@ -559,6 +559,10 @@ if (apr_os_file_put(&file, &listen_handle, 0, tp)) goto CLEANUP; + /* required for APR 1.3+ */ + if (apr_procattr_io_set(procattr, APR_FULL_BLOCK, APR_NO_FILE, APR_NO_FILE)) + goto CLEANUP; + /* procattr is opaque so we have to use this - unfortuantely it dups */ if (apr_procattr_child_in_set(procattr, file, NULL)) goto CLEANUP; From whoami at autistici.org Wed Aug 27 10:50:42 2008 From: whoami at autistici.org (WhoAmI) Date: Wed, 27 Aug 2008 16:50:42 +0200 Subject: [FASTCGI] Debian - Php5 - FastCGI Issue Message-ID: <061a6cee1ec58aa072a0d44ac110ffca@localhost> Hello list, I'm using Apache2+FastCGI+Php5 on Debian Etch and i think i've this issue: https://bugs.launchpad.net/debian/+bug/162082 FastCGI + Php5 use up all the available RAM. Is there any new workaround/fix? (this workaround doesn't work for me http://launchpadlibrarian.net/14265535/phpkiller.sh) Do you know if its work fine on Gentoo? Thanks --WhoAmI- Email: whoami at autistici.org WebSite: http://www.autistici.org/whoami/ From chris_se at gmx.net Thu Aug 28 00:50:46 2008 From: chris_se at gmx.net (Christian Seiler) Date: Thu, 28 Aug 2008 06:50:46 +0200 Subject: [FASTCGI] [PATCH] Updated patch for -pass-header correct handling Message-ID: <48B62EA6.8070407@gmx.net> Hi, I was contacted about my patch for correctly handling the -pass-header option [1]. It turns out that my patch didn't work with Apache 1.3 - I just updated it so that it works with Apache 1.3, too.: http://www.christian-seiler.de/temp/mod_fastcgi-patches/pass-headers.patch And I somehow can't find my followup posting in the public archives, so I'll repost the patch for the other issue I had with mod_fastcgi, for anyone who's interested: > Also, I discovered another issue with mod_fastcgi: If a CGI script sends > two 'Status: ' headers, mod_fastcgi will cause an internal server error. > Yes, it may not be a very good idea to send two status lines BUT a) the > CGI specification does not forbid it explicitely and b) Apache does not > complain when this happens with normal CGI scripts. As I see no reason > to enforce such strictness (Apache with normal CGI doesn't, lighttpd > with FastCGI doesn't) and I came across a few scripts that caused this > kind of problem with mod_fastcgi, here's a patch that removes the > duplicate header check: > http://www.christian-seiler.de/temp/mod_fastcgi-patches/duplicate-allowed.patch Regards, Christian [1] From jsprenkle at gmail.com Fri Aug 29 08:47:18 2008 From: jsprenkle at gmail.com (Jay Sprenkle) Date: Fri, 29 Aug 2008 07:47:18 -0500 Subject: [FASTCGI] bug in os_win32.c Message-ID: <1b5f39a10808290547g197afc61h864b1213135a0a60@mail.gmail.com> I've found a bug in the fastcgi source: The original code from os_win32.c: if (*bindPath != ':') { char * p = strchr(bindPath, ':'); int len = p - bindPath + 1; host = malloc(len); strncpy(host, bindPath, len); host[len] = '\0'; } If this code is executed the last line that null terminates the allocated buffer writes past the end of the allocated space. It probably ought to be this: if (*bindPath != ':') { char * p = strchr(bindPath, ':'); int len = p - bindPath; host = malloc(len + 1); strncpy(host, bindPath, len); host[len] = '\0'; } more to come... Jay