Why is marshalling not thread-safe? (2.04)

From: Gerd Stolpmann (Gerd.Stolpmann@darmstadt.netsurf.de)
Date: Thu Jan 13 2000 - 03:44:14 MET

  • Next message: Daniel de Rauglaudre: "Re: Q: camlp4 use?"

    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                     
    ----------------------------------------------------------------------------
    



    This archive was generated by hypermail 2b29 : Thu Jan 13 2000 - 17:33:17 MET