From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA06853; Fri, 22 Mar 2002 15:55:38 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 PAA08441 for ; Fri, 22 Mar 2002 15:55:38 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g2MEta508401; Fri, 22 Mar 2002 15:55:36 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA07032; Fri, 22 Mar 2002 15:55:35 +0100 (MET) Date: Fri, 22 Mar 2002 15:55:35 +0100 From: Xavier Leroy To: Francois Rouaix Cc: caml-list@inria.fr Subject: Re: [Caml-list] threads Message-ID: <20020322155535.A6948@pauillac.inria.fr> References: <000001c1cfbb$460b3c60$ca01a8c0@homebox> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <000001c1cfbb$460b3c60$ca01a8c0@homebox>; from frouaix@yahoo.com on Tue, Mar 19, 2002 at 06:59:38PM -0800 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Is anyone using native threads in Ocaml 3.04 intensively on Linux these > days ? We occasionally get bug reports similar to yours, under Linux. It's hard to say whether it's a bug in the OCaml system thread library, or in LinuxThreads itself. > The program "hangs", ps looks like this. Looks like a thread is stuck. > > 18964 pts/3 S 0:00 ./camella.opt > 18965 pts/3 Z 0:00 [camella.opt ] > 18967 pts/3 S 0:00 ./camella.opt Actually, it looks like the thread manager thread (PID N+1, where N is the initial PID of the program) died. It should not, and it is not surprising that the program hangs, since once the thread manager is gone the program can no longer create new threads. > I'm playing with a Gnutella servent, and I'm experimenting crashes > (bytecode and native). > I'm using the unix library heavily. So far, I'm aware that the DNS calls > are not reentrant, but the rest of the library calls should be okay. Yes, that's another issue: OCaml allows several threads to call Unix.gethostbyname concurrently (without holding the master mutex), yet most if not all implementations of gethostbyname() are not reentrant. As Nikolaj Bjorner mentioned, some systems provide a reentrant gethostbyname_r() function, not necessarily with the same interface, though, making it very hard to use in the Unix library. (An easy way to see if your problems are related to gethostbyname is to protect calls to Unix.gethostbyname by a mutex, to ensure that only one at a time is performed.) - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners