From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA11026 for caml-redistribution; Thu, 13 Jan 2000 17:27:16 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA18577 for ; Thu, 13 Jan 2000 04:00:02 +0100 (MET) Received: from beach.frankfurt.netsurf.de ([194.64.181.2]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id EAA20216 for ; Thu, 13 Jan 2000 04:00:00 +0100 (MET) Received: from ice.darmstadt.netsurf.de (board-34.darmstadt.netsurf.de [194.163.86.162]) by beach.frankfurt.netsurf.de (8.8.5/8.8.5) with ESMTP id DAA10814 for ; Thu, 13 Jan 2000 03:59:59 +0100 (MET) Received: from localhost (localhost [[UNIX: localhost]]) by ice.darmstadt.netsurf.de (8.9.3/8.9.3) id DAA03668 for caml-list@inria.fr; Thu, 13 Jan 2000 03:58:40 +0100 From: Gerd Stolpmann Reply-To: Gerd.Stolpmann@darmstadt.netsurf.de Organization: privat To: caml-list@inria.fr Subject: Why is marshalling not thread-safe? (2.04) Date: Thu, 13 Jan 2000 03:44:14 +0100 X-Mailer: KMail [version 1.0.28] Content-Type: text/plain MIME-Version: 1.0 Message-Id: <00011303584000.03639@ice> Content-Transfer-Encoding: 8bit Sender: weis Hi, I'm currently writing a multi-threaded server which communicates with its clients by O'caml's marshalling module. After some segfaults I found out that the output_value and input_value primitives are not thread-safe, because there are some global variables (extern_table, intern_input) for which there is only one instance for all threads. (The segfaults happened when one of these variables was freed.) The code contains some mutexes, but these mutexes only protect the structures of the channels, and not these global variables. So I think that thread-safety was intended but never checked, am I right? At the first glance, there seems to be a simple solution of the problem, because it is possible to avoid these global variables and pass them as arguments to the functions needing them. But I did not check this in detail. Is it possible to get marshalling reentrant? A multi-threaded server is more or less senseless if marshalling is serialized. Gerd -- ---------------------------------------------------------------------------- Gerd Stolpmann Telefon: +49 6151 997705 (privat) Viktoriastr. 100 64293 Darmstadt EMail: Gerd.Stolpmann@darmstadt.netsurf.de (privat) Germany ----------------------------------------------------------------------------