Recently had some serious trouble running Trac on Apache2 with mod_fcgid. An included Doxygen page spent hours loading and the Apache error log contained lines like this:

[Sat Apr 21 21:38:26 2012] [warn] [client] mod_fcgid: can't apply process slot for /home/webX/trac/htdocs/favicon.ico
[Sat Apr 21 21:42:01 2012] [warn] [client] mod_fcgid: read data timeout in 40 seconds
[Sat Apr 21 21:42:01 2012] [error] [client] Premature end of script headers: trac.fcgi

The cause I finally discovered was that I had mixed up several ways of running Trac (mod_python, mod_fastcgi, mod_fcgid) while testing performance, so the lines in my Trac vhost looked like this (including the disabled lines):

<VirtualHost x.y.z.w:80>

    DocumentRoot /home/webX/trac/htdocs
    Alias /chrom/common /usr/share/pyshared/trac/htdocs
    Alias /chrome/site /home/webX/trac/htdocs
    Alias /favicon.ico /home/webX/trac/htdocs/favicon.ico

    <Directory "/usr/share/pyshared/trac/htdocs">
        Order allow,deny
        Allow from all
    <Directory /home/webX/trac/htdocs>
        Order allow,deny
        Allow from all

    ScriptAlias / /home/webX/trac/fcgi/trac.fcgi/
#   <Location />
#       SetHandler fcgid-script
#       Options ExecCGI
#       Allow from all
#   </Location>

    <Location "/login">
        AuthType Basic
        AuthName "Trac"
        AuthUserFile "/home/webX/trac/passwd.htaccess"
        Require valid-user

    CustomLog /var/log/apache2/ combined
    ErrorLog /var/log/apache2/

Removed the superfluous <Location> - Block and trouble was gone :)