caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Uncaught Unix_error.
@ 2009-06-18 12:16 Romain Beauxis
  2009-06-18 13:17 ` [Caml-list] " Stéphane Glondu
  0 siblings, 1 reply; 8+ messages in thread
From: Romain Beauxis @ 2009-06-18 12:16 UTC (permalink / raw)
  To: caml-list

	Hi all !

We have had a strange bug report on our code. Somehow, an Unix.Unix_error 
exception was not caught while it ought to be. See:
  http://savonet.rastageeks.org/ticket/269

We have precisely characterized the issue in the code, and we would like to 
understand its possible origin.

If we look at the code for raising exceptions in otherlib/unixsupport.c, we 
have:
    if (unix_error_exn == NULL) {
      unix_error_exn = caml_named_value("Unix.Unix_error");
      if (unix_error_exn == NULL)
        invalid_argument("Exception Unix.Unix_error not initialized, please 
link unix.cma");
    }

This code fetches the pointer to the named_value representing an 
Unix.Unix_error, and assigns it to a static variable.

However, the threads module also registers an exception of the same name, 
probably because both modules are mutually exclusive.

We believe that the issue is raised because the module that uses Unix.read is 
compiled with one of unix or threads and the application using that module 
with the other one.

In this case, it should be possible that the static value representing the 
exception is initialized with a wrong pointer and  never updated afterwards.

We were unable yet to reproduce the issue on a minimal code, it was caused by 
a portmap scan on the telnet server, which uses Unix.read calls to read from 
the network socket.

We don't really know if this is a known issue, or if there is something to do 
about this from our side, so we wanted to report it here...


Romain


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-06-19 13:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-18 12:16 Uncaught Unix_error Romain Beauxis
2009-06-18 13:17 ` [Caml-list] " Stéphane Glondu
2009-06-18 13:28   ` Romain Beauxis
2009-06-18 14:41   ` David Baelde
2009-06-18 16:47     ` Jake Donham
2009-06-18 19:21     ` Stéphane Glondu
2009-06-18 20:16       ` David Baelde
2009-06-19 13:23       ` Romain Beauxis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).