Apache [client ::1] requests, broken pipes, virtual hosts and Drupal

I was puzzling over entries like this in Apache 2.2.3's error log:

[info] [client ::1] (32)Broken pipe: core_output_filter: writing data to the network

A check for which user agent was causing that revealed:

::1 - - [01/Dec/2007:04:08:53 +0000] "GET / HTTP/1.0" 200 85781 "-" "Apache/2.2.3 (CentOS) (internal dummy connection)"

So it's Apache's internal dummy connection throwing the errors. Oh, but what's this?

::1 - - [01/Dec/2007:04:08:53 +0000] "GET / HTTP/1.0" 200 <strong><span style="text-decoration: underline">85781</span></strong> "-" "Apache/2.2.3 (CentOS) (internal dummy connection)"

Yikes! Here's what is happening.

1. Apache opens an internal dummy connection with a request for /.
2. On this server, / turns out to be a Drupal page.
3. Drupal spends time and effort putting together the page and sends it...
4. ...to the dummy connection that ignores it resulting in the broken pipe.

It turned out that in httpd.conf, an include statement which pulled in a virtual host configuration was being encountered before the regular virtual host configuration...making the included virtual host configuration the default host for all requests, including internal Apache requests.

I solved this by making sure the default page of the first virtual host is not a dynamic page.



Every now and then, I spent a little time to research and
debug this stupid "Broken pipe" message that became oh so familiar ever since we switched to Drupal. Actually, I knew it wasn't really a problem, just a minor nuisance , but it really drove me nuts that I couldn't get rid of this one.
Somehow my vhost include statements had gotten out of order (and remained for years ) and the Drupal vhost had been the default one ever since. So thanks for this very useful hint :-)