[FASTCGI] apache 2.2+fastcgi+cgicc

Jay Sprenkle jsprenkle at gmail.com
Tue Aug 26 00:30:14 EDT 2008

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():


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,


More information about the FastCGI-developers mailing list