From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p8AIwJdx027184 for ; Sat, 10 Sep 2011 20:58:19 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AokBAKuya07UGyoBkWdsb2JhbABBoV6GOxQBAQEBCQsLBxQDI4IACwGBAjQdMogLtDyGbgSYcYMTiFc X-IronPort-AV: E=Sophos;i="4.68,361,1312149600"; d="scan'208";a="119170875" Received: from smtp1-g21.free.fr ([212.27.42.1]) by mail1-smtp-roc.national.inria.fr with ESMTP; 10 Sep 2011 20:58:13 +0200 Received: from UNKNOWN (unknown [172.20.243.134]) by smtp1-g21.free.fr (Postfix) with ESMTP id 8FEDF94011D; Sat, 10 Sep 2011 20:58:06 +0200 (CEST) Received: by UNKNOWN (Postfix, from userid 0) id 8ABAE93091529; Sat, 10 Sep 2011 20:58:05 +0200 (CEST) Received: from ([66.108.127.87]) by imp.free.fr (IMP) with HTTP for ; Sat, 10 Sep 2011 20:58:05 +0200 Message-ID: <1315681085.4e6bb33d6df0e@imp.free.fr> Date: Sat, 10 Sep 2011 20:58:05 +0200 From: pierrchp@free.fr To: caml-list@inria.fr, ocsigen@sympa.mancoosi.univ-paris-diderot.fr MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.8 X-Originating-IP: 66.108.127.87 Subject: [Caml-list] Ocamlnet, netclient and lwt_preemptive causing ocsigen segfault Hello, I have a web application written using lwt and ocsigen that needs to get data using https. In order to do that, I use the Http_client.Convenience module from Ocamlnet, and use Lwt.detach to perform the call (there probably is a smater way to do this, I am open to any suggestion). The http call is performed and the data is displayed, but then the server crashed, apparently because of a segfault. here is the code for a test eliom module that reproduce the problem, compiled using ocamlfind ocamlc -c -thread -package equeue-ssl,netclient,lwt,lwt.preemptive,ocsigen test_server.ml Cheers -Pierre (*************************************) open Lwt open XHTML.M open Eliom_services open Eliom_parameters open Eliom_sessions open Eliom_predefmod.Xhtml;; (* initialising Http_client.Convenience to use https *) Ssl.init(); Http_client.Convenience.configure_pipeline (fun p -> let ctx = Ssl.create_context Ssl.TLSv1 Ssl.Client_context in let tct = Https_client.https_transport_channel_type ctx in p # configure_transport Http_client.https_cb_id tct ) ;; module H = Http_client.Convenience let test_service = new_service ~path:[""] ~get_params:unit () ;; let test_handler = fun sp () () -> (* thread that request data from a url *) Lwt_preemptive.detach (function () -> H.http_get "https://ocsigen.org") () >>= function s -> (*page that display the data*) return ( html (head (title (pcdata "test")) []) (body [ h1 [pcdata "the data are:"]; p [ pcdata s] ] ) ) ;; register test_service test_handler;;