Problems with CLISP and Fastcgi

Discussion of Common Lisp
Post Reply
schoppenhauer
Posts: 99
Joined: Sat Jul 26, 2008 2:30 pm
Location: Germany
Contact:

Problems with CLISP and Fastcgi

Post by schoppenhauer » Wed Sep 15, 2010 8:20 pm

I managed to compile CLISP with the FastCGI-Module on Debian, using the Debian-Sources under squeeze and adding the configure-flag --with-module=fastcgi. Now, *features* contains :FASTCGI.

Running the example given on http://clisp.cons.org/impnotes/fastcgi.html in cgi-mode anything works fine. Running it in fastcgi-mode, the server takes a long time and then quits with an internal server error.

The Apache-Log sais:

Code: Select all

[Thu Sep 16 05:17:12 2010] [warn] FastCGI: (dynamic) server "/usr/lib/cgi-bin/test.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
[Thu Sep 16 05:17:15 2010] [warn] FastCGI: (dynamic) server "/usr/lib/cgi-bin/test.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
[Thu Sep 16 05:17:18 2010] [warn] FastCGI: (dynamic) server "/usr/lib/cgi-bin/test.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
[Thu Sep 16 05:17:21 2010] [warn] FastCGI: (dynamic) server "/usr/lib/cgi-bin/test.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
[Thu Sep 16 05:17:24 2010] [warn] FastCGI: (dynamic) server "/usr/lib/cgi-bin/test.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
[Thu Sep 16 05:17:27 2010] [warn] FastCGI: (dynamic) server "/usr/lib/cgi-bin/test.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
[Thu Sep 16 05:17:30 2010] [warn] FastCGI: (dynamic) server "/usr/lib/cgi-bin/test.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
[Thu Sep 16 05:17:33 2010] [warn] FastCGI: (dynamic) server "/usr/lib/cgi-bin/test.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
[Thu Sep 16 05:17:36 2010] [warn] FastCGI: (dynamic) server "/usr/lib/cgi-bin/test.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
[Thu Sep 16 05:17:39 2010] [warn] FastCGI: (dynamic) server "/usr/lib/cgi-bin/test.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
[Thu Sep 16 05:17:42 2010] [error] [client 88.217.1.217] FastCGI: comm with (dynamic) server "/usr/lib/cgi-bin/test.fcgi" aborted: (first read) idle timeout (30 sec)
[Thu Sep 16 05:17:42 2010] [warn] FastCGI: (dynamic) server "/usr/lib/cgi-bin/test.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
[Thu Sep 16 05:17:42 2010] [error] [client 88.217.1.217] FastCGI: incomplete headers (0 bytes) received from server "/usr/lib/cgi-bin/test.fcgi"
Any Ideas?
Sorry for my bad english.
Visit my blog http://blog.uxul.de/

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Problems with CLISP and Fastcgi

Post by nuntius » Wed Sep 15, 2010 9:32 pm

So you're running the example code from 33.18.3?

You could instrument it to dump debug info, maybe to a file in /tmp. Is the script not finding the proper clisp executable? Is the fastcgi library not loading? Is (fastcgi:accept) returning nil? Those are the only obvious reasons for the script to terminate.

schoppenhauer
Posts: 99
Joined: Sat Jul 26, 2008 2:30 pm
Location: Germany
Contact:

Re: Problems with CLISP and Fastcgi

Post by schoppenhauer » Thu Sep 16, 2010 5:39 am

Ok. I changed the LogLevel to Debug. Somehow, fastcgi:write-stdout doesnt support the application of more than one string as an argument. Additionally, what confused me is that the only possibility to be really sure that the fastcgi-script is re-read is to completely restart apache.

The following code works for me:

Code: Select all

#! /usr/bin/clisp -q -K full

(with-open-file (s "/tmp/blabla" :direction :output :if-exists :supersede)

(do ((count 1 (1+ count)))
    ((not (fastcgi:accept)) nil)

  (format s "accept did not return nil~%")
        (force-output s)

  (fastcgi:write-stdout (concatenate 'string "Content-type: text/plain" (list #\Newline #\Newline)
   "I am running in mode: " (if (fastcgi:is-cgi) "CGI" "FastCGI") (list #\Newline)
   "This is execution no.: " (format nil "~d" count) (list #\Newline)
   "The browser string is '" (fastcgi:getenv "HTTP_USER_AGENT") "'" (list #\Newline)
))
  (fastcgi:finish))

(format s "exited~%")
(force-output s))
Sorry for my bad english.
Visit my blog http://blog.uxul.de/

Post Reply