From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 07C5FBC48 for ; Tue, 19 Apr 2005 22:13:06 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j3JKD6hW030775 for ; Tue, 19 Apr 2005 22:13:06 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA26929 for ; Tue, 19 Apr 2005 22:13:06 +0200 (MET DST) Received: from us19.unix.fas.harvard.edu (us19.unix.fas.harvard.edu [140.247.35.199]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j3JKD5Ko021507 for ; Tue, 19 Apr 2005 22:13:05 +0200 Received: from ls04.fas.harvard.edu (ls04.fas.harvard.edu [140.247.34.104]) by us19.unix.fas.harvard.edu (8.12.11/8.12.11) with ESMTP id j3JKD4dN031127; Tue, 19 Apr 2005 16:13:04 -0400 Received: by ls04.fas.harvard.edu (Postfix, from userid 19885) id 7EB501C048; Tue, 19 Apr 2005 16:13:04 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by ls04.fas.harvard.edu (Postfix) with ESMTP id 74DA324034; Tue, 19 Apr 2005 16:13:04 -0400 (EDT) Date: Tue, 19 Apr 2005 16:13:04 -0400 (EDT) From: Michael Alexander Hamburg To: Christophe TROESTLER Cc: caml-list@inria.fr Subject: Re: [Caml-list] CamlGI question In-Reply-To: <20050419.133304.40952590.debian00@tiscali.be> Message-ID: References: <810e04dc0f6bb601fb828db8d18def6c@fas.harvard.edu> <20050419.133304.40952590.debian00@tiscali.be> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 42656652.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42656651.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 christophe:01 troestler:01 mli:01 submodules:01 ocaml:01 indexing:01 lib:01 buffered:01 terminate:01 buffering:01 threading:01 buffered:01 ...:98 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: On Tue, 19 Apr 2005, Christophe TROESTLER wrote: > On Mon, 18 Apr 2005, Mike Hamburg wrote: > > > > http://capricorn.dnsalias.org/mike/index/ > > I downloaded your files. For a start, all the modules are -pack'ed > into camlGI.cm[x]a, so you only need to link with that file. Also, > the interface of the library is in camlGI.mli with complete > documentation. In particular, you should not use hidden submodules: > e.g. in "path.ml", say [open CamlGI] and then [Cgi.HttpError] instead > of [Cgi_types.HttpError]. Same in "index.ml": you should say [open > CamlGI.Cgi], not [open Cgi]. > > [Request.metavar rq.rq "SERVER_NAME"] can simply be replaced with > [Request.server_name rq.rq] > > [cgi#header_was_emitted ()]: such method does not exist in the public > interface. It doesn't exist at all. I added it because I was getting mysterious type errors from OCaml when trying to compile directly. It was on my "things to clean up" list. > I do not see why you set [rq=request] as the request can be gotten > from the cgi object [cgi#request]. You're right, I missed that. > > When used as a FastCGI, the indexing script hangs, [...] It is quite > > clear that the script has finished by the time the hang occurs > > Do the examples provided with the lib work as they should? I'll check that too (I'm not at home right now). > Are you sure your [main] function actually terminates? Indeed, the > output is buffered (at least by CamlGI) and may not be fully outputted > until the script finishes. Also, if you wish to launch a new > process/thread per request, be sure to use the [fork] optional > parameter to [handle_requests ?fork f conn] -- otherwise [f] will > return immediately and the output "channel" will be closed early. My main function does actually terminate. I put a logging message at the end of the function. And it's not just buffering output, as killing the CGI script with signal 9 causes no truncation. I'll set it to create a new thread to handle the request, although that doesn't particularly matter (the threading is necessary to keep the thumbnail cache running, not for load issues). > CamlGI follows closely the spec -- even the multiplexing part which is > not implemented by many. > > > The plain CGI version works just fine > > CGI output is not buffered. > > > the features of the script only work in the FastCGI version, such as > > thumbnailing. > > Why is that? Do you need persistence for that? I can do it without persistence, but synchronization is much more difficult in that case, eg, preventing to processes from trying to thumbnail the same files at the asme time. > Hope it helps. If it does not, send me an example (if possible > minimal but definitely self-contained) that exhibits the undesired > behavior and I'll have a look. I'll work on it soon and figure out whether this helps or not. Hopefully it will. > ChriS > Thanks a lot for your help, Mike