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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id E8C71BBAF for ; Thu, 28 Oct 2010 14:18:58 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiIBAE4HyUzUGyoFkWdsb2JhbACTUI14FQEBAQEJCwoHEQMfvmyFSASNdA X-IronPort-AV: E=Sophos;i="4.58,251,1286143200"; d="scan'208";a="76694717" Received: from smtp5-g21.free.fr ([212.27.42.5]) by mail4-smtp-sop.national.inria.fr with ESMTP; 28 Oct 2010 14:18:41 +0200 Received: from apc.happyleptic.org (unknown [82.67.194.89]) by smtp5-g21.free.fr (Postfix) with ESMTP id EC53ED48092 for ; Thu, 28 Oct 2010 14:18:13 +0200 (CEST) Received: from ccellier.rd.securactive.lan (extranet.securactive.org [82.234.213.170]) by apc.happyleptic.org (Postfix) with ESMTP id 3ACEF33872 for ; Thu, 28 Oct 2010 14:19:14 +0200 (CEST) Received: from rixed by ccellier.rd.securactive.lan with local (Exim 4.71) (envelope-from ) id 1PBRQo-0008Vy-RU for caml-list@inria.fr; Thu, 28 Oct 2010 14:18:10 +0200 Date: Thu, 28 Oct 2010 14:18:10 +0200 From: Cedric Cellier To: caml-list@inria.fr Subject: Thread.delay to raise EINTR exception ? Message-ID: <20101028121810.GA32597@securactive.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Spam: no; 0.00; eintr:01 uncaught:01 strace:01 eintr:01 uncaught:01 bug:01 ...,:98 ...,:98 unix:01 unix:01 exception:01 exception:01 gprof:03 gprof:03 raise:03 Hello list ! I'm using Thread.delay on a unix platform, and sometimes it seams that the thread that called Thread.delay is killed because it did not catch the exception that seams to be raised from the delay : Thread 1 killed on uncaught exception Unix.Unix_error(11, "select", "") Raised at file "thread.ml", line 60, characters 23-50 This happens frequently when I run the program with gprof (since gprof uses an alarm signal apparently). Here is the relevant section of strace, showing the delay as a select with timeout and the gprof signal : 32506 select(0, [], [], [], {0, 2153}) = 0 (Timeout) 32506 select(0, [], [], [], {0, 2647}) = 0 (Timeout) 32506 select(0, [], [], [], {0, 2030}) = ? ERESTARTNOHAND (To be restarted) 32506 --- SIGPROF (Profiling timer expired) @ 0 (0) --- 32506 rt_sigreturn(0x1b) = -1 EINTR (Interrupted system call) 32506 write(2, "Thread 1 killed on uncaught exce"..., 72) = 72 32506 write(2, "Raised at file \"thread.ml\", line"..., 54) = 54 The problem I have with this, is that in my opinion this is not a correct behavior for the Thread.delay function : This underlying select should handle EINTR internaly, and it seams wrong to me to have to "try" Thread.delay in my program. What do you think ? Should I fill a bug ?