[Haskell-beginners] FastCGI error

Wayne R reginald.wayne.richards at gmail.com
Mon Aug 9 12:17:52 EDT 2010


I'm trying to use Network.FastCGI with Apache2, but running into an error.
I'd like to believe that the web server is configured correctly, because I
can successfully view the following, compiled to <web
root>/fastcgi/test.fcgi:

#include <fcgi_stdio.h>

int main(void){
  int count = 0;
  while(FCGI_Accept()>=0){
   printf("Content-Type: text/html\r\n");
   printf("\r\n");
   printf("Hello, World: %d", count++);
  }
  return 0;
}

Now I compile Fcgi.hs to <web root>/fastcgi/test2.fcgi:

import Control.Concurrent
import Network.FastCGI

action :: CGI CGIResult
action = do
        setHeader "Content-type" "text/plain"
        tid <- liftIO myThreadId
        output $ unlines
            [ "I am a FastCGI process!"
            , "Hear me roar!"
            , ""
            , show tid
            ]

main = runFastCGIConcurrent' forkIO 10 action


When I view localhost/fastcgi/test.fcgi, I get the hello world page, but
attempting to view test2.fcgi shows an 'Internal Server Error" in firefox.
The apache error log says:

[Sun Aug 08 07:44:17 2010] [notice] Apache/2.2.14 (Ubuntu) mod_fastcgi/2.4.6
mod_lisp2/1.3.1 PHP/5.3.2-1ubuntu4.2 with Suhosin-Patch mod_ssl/2.2.14
OpenSSL/0.9.8k configured -- resuming normal operations
[Mon Aug 09 11:11:23 2010] [warn] FastCGI: (dynamic) server
"/var/www/fastcgi/test.fcgi" started (pid 20354)
[Mon Aug 09 11:11:27 2010] [warn] FastCGI: (dynamic) server
"/var/www/fastcgi/test2.fcgi" started (pid 20360)
[Mon Aug 09 11:11:31 2010] [warn] FastCGI: (dynamic) server
"/var/www/fastcgi/test2.fcgi" started (pid 20365)
[Mon Aug 09 11:11:34 2010] [warn] FastCGI: (dynamic) server
"/var/www/fastcgi/test2.fcgi" started (pid 20371)
[Mon Aug 09 11:11:37 2010] [warn] FastCGI: (dynamic) server
"/var/www/fastcgi/test2.fcgi" started (pid 20375)
[Mon Aug 09 11:11:40 2010] [warn] FastCGI: (dynamic) server
"/var/www/fastcgi/test2.fcgi" started (pid 20379)
[Mon Aug 09 11:11:43 2010] [warn] FastCGI: (dynamic) server
"/var/www/fastcgi/test2.fcgi" started (pid 20383)
[Mon Aug 09 11:11:46 2010] [warn] FastCGI: (dynamic) server
"/var/www/fastcgi/test2.fcgi" started (pid 20387)
[Mon Aug 09 11:11:49 2010] [warn] FastCGI: (dynamic) server
"/var/www/fastcgi/test2.fcgi" started (pid 20391)
[Mon Aug 09 11:11:52 2010] [warn] FastCGI: (dynamic) server
"/var/www/fastcgi/test2.fcgi" started (pid 20395)
[Mon Aug 09 11:11:55 2010] [warn] FastCGI: scheduled the start of the last
(dynamic) server "/var/www/fastcgi/test2.fcgi" process: reached
dynamicMaxClassProcs (10)
[Mon Aug 09 11:11:55 2010] [warn] FastCGI: (dynamic) server
"/var/www/fastcgi/test2.fcgi" started (pid 20399)
[Mon Aug 09 11:12:01 2010] [error] [client 127.0.0.1] FastCGI: comm with
(dynamic) server "/var/www/fastcgi/test2.fcgi" aborted: (first read) idle
timeout (30 sec)
[Mon Aug 09 11:12:01 2010] [error] [client 127.0.0.1] FastCGI: incomplete
headers (0 bytes) received from server "/var/www/fastcgi/test2.fcgi"

I've tried Fcgi.hs with two different sample FastCGI programs with the same
results.  Any suggestions?

Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100809/b7cd406e/attachment-0002.html


More information about the Beginners mailing list