On Tue, Apr 12, 2005 at 06:26:48PM -0700, mso@oz.net wrote:
> OK, I did a bunch of more tests. The same problem happens with Apache
> 1.3.33 and mod_scgi 1. Pressing Reload or Shift-Reload on any page in a
> StaticDirectory produces: (1) Internal Server Error, (2) the page without
> images, (3) the page correctly. It keeps on cycling in approximately that
> order.
>
> If you reload a dynamic page, the dynamic HTML always comes up but any
> dependent content (images, stylesheet) have a 50/50 chance of
> disappearing. Sometimes the images and stylesheet disappear
> alternatingly. (The dependent content are separate StaticFile instances
> in this case.)
>
> Whenever (1) or (2) happens, Apache2 logs:
> [Tue Apr 12 17:02:12 2005] [error] [client 127.0.0.1] (304)Unknown error
> 304: scgi: Unknown error 304: error reading response headers
>
> Apache1 logs almost the same thing:
> [Tue Apr 12 17:01:53 2005] [error] [client 127.0.0.1] scgi: error reading
> response headers
That's strange. What OS are you using? If you can, try recording
the Apache<->SCGI server coversation using tcpdump. For example, if
your SCGI server is listening on port 3000, as root run:
# tcpdump -i lo -s 9000 -w capture.dat port 3000
After tcpdump is running then try reloading the page in your browser
to provoke the problem. Use Control-C to stop capturing. If you
send me the capture file then I will take a look at it. You can use
different tools to look at the capture file. I like Ethereal:
$ ethereal -r capture.dat
The "follow TCP stream" function is really useful.
> How does the SCGI server handle concurrency? mod_scgi uses multiple
> processes, but there's only one server process. Does each request wait
> till the previous one is done? Does that mean Apache's multiproces model
> doesn't really solve anything because there's still a server bottleneck?
> Could that be why I'm having problems with dependent images? But why
> should StaticFiles be more affected?
The SCGI server uses a pre-fork model. There is a parent process
that forks off worker children. When a request comes in the parent
receives it and passes it to one of the children. The child takes
care of the request and notifies the parent when it has finished.
> There's another problem with all SCGI versions (1, 2, and cgi2scgi). If
> the script_name specified to the SCGI server at launch does not match the
> URL prefix actually requested, Apache says "premature end of script
> headers" and the Quixote error log doesn't say a peep. That's with the
> SCGI server running as a system service (launched from /etc/init.d).
You really need to redirect the stderr of the server process
somewhere. Ideally I guess it should go the same place as the
Quixote error log by default. Currently it does not.
Neil