[FASTCGI] Fastcgi C++ error on Apache and windows

Saikat Kanjilal sxk1969 at hotmail.com
Mon Aug 18 17:00:53 EDT 2008

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[] )


        //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())
        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®.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.pins.net/mailman/private.cgi/fastcgi-developers/attachments/20080818/1492f4cb/attachment.html>

More information about the FastCGI-developers mailing list