From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 32516BBAF for ; Wed, 16 Jun 2010 12:08:29 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjwCAGU/GExRZ90xkWdsb2JhbACeeRUBAQEBCQsKBxEDH78NhRoE X-IronPort-AV: E=Sophos;i="4.53,425,1272837600"; d="scan'208";a="52492249" Received: from mtaout03-winn.ispmail.ntl.com ([81.103.221.49]) by mail3-smtp-sop.national.inria.fr with ESMTP; 16 Jun 2010 12:08:28 +0200 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20100616100828.GPFR3075.mtaout03-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com>; Wed, 16 Jun 2010 11:08:28 +0100 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout04-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20100616100828.XSNA1593.aamtaout04-winn.ispmail.ntl.com@romulus.metastack.com>; Wed, 16 Jun 2010 11:08:28 +0100 Received: from Tenor ([172.16.0.8]) (authenticated bits=0) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id o5GA8Jnr027889 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 16 Jun 2010 11:08:20 +0100 From: "David Allsopp" To: "'Paul Steckler'" , References: <2EB36A07AAE8C44BBB1986425E7A22D0127E01BE32@atp-mbx1.in.nicta.com.au> In-Reply-To: <2EB36A07AAE8C44BBB1986425E7A22D0127E01BE32@atp-mbx1.in.nicta.com.au> Subject: RE: [Caml-list] Unix.send blocks Date: Wed, 16 Jun 2010 11:08:13 +0100 Message-ID: <009101cb0d3b$d63748d0$82a5da70$@romulus.metastack.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHTX5qxVZzb5yMgUYRGsslcZOl0zwIpcRbI Content-Language: en-gb Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 81.102.132.77 X-Cloudmark-Analysis: v=1.1 cv=1ggfb5FlKZQUfF3vzm9UBYZ2uTfLsbs/8dSljwg5+mE= c=1 sm=0 a=mI6YO6ZdSLUA:10 a=8sW17jYxVu0A:10 a=kj9zAlcOel0A:10 a=s3XALLbj0aZqgqaimaAA:9 a=PEW7BBxSWddZRF8sNjkA:7 a=PXtJ5PEZyx2RXMRwSW_zyofrcPkA:4 a=CjuIK1q_8ugA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Spam: no; 0.00; steckler:01 ocaml:01 ocamlopt:01 mingw:01 ocaml:01 freezes:01 ocamlopt:01 ocamlnet:01 ocamlnet:01 wrote:01 unix:01 unix:01 compile:01 caml-list:01 hangs:01 k/Paul Steckler wrote: > I've written a wee Web server in OCaml that's compiled using the ocamlopt > from the Fedora MinGW distribution of ocaml. I'm running the server in > Windows 7. > > Sometimes after receiving several requests, the Unix.send call that sends > a response back to a Web client just blocks. Sounds like terminology may be getting in the way of a solution - do you mean that the call *blocks* for a longer time than you expect then carries on working (the usual meaning of "block" - i.e. the call to send doesn't return until it's actually finished) or do you mean *freezes* - i.e. the call seemingly *never* returns and so your application hangs. When this happens on a given connection, does that prevent further connections from working - i.e. is the entire server dead or just that one connection? Additionally, just applying the usual debugging principle of "simplify, simplify and then simplify some more", why not eliminate the cross-compiler and instead use ocamlopt directly on Windows? David PS Although it's not your question, why are you writing a web server? CGI+IIS (if Windows is your target) is dead easy and if you do strictly want your own webserver then there's one in ocamlnet (although I'm not sure if that part works under Windows - my default compiled version of ocamlnet 2.2.9 doesn't seem to have it but that may be because by default it's not compiled rather than that it's not possible to compile it). Given that you've hit problems, reinventing the wheel seems potentially questionable.