From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id EACF0BC37 for ; Thu, 18 Jun 2009 14:15:58 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsEACrNOUpYvxGE/2dsb2JhbACBUM8PhAgF X-IronPort-AV: E=Sophos;i="4.42,244,1243807200"; d="scan'208";a="29759985" Received: from www.rastageeks.org (HELO mail.rastageeks.org) ([88.191.17.132]) by mail3-smtp-sop.national.inria.fr with ESMTP; 18 Jun 2009 14:15:58 +0200 Received: from leonard.localnet (sphinx.lix.polytechnique.fr [129.104.11.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.rastageeks.org (Postfix) with ESMTPSA id 7ECE5277A7 for ; Thu, 18 Jun 2009 14:15:57 +0200 (CEST) From: Romain Beauxis To: caml-list@inria.fr Subject: Uncaught Unix_error. Date: Thu, 18 Jun 2009 14:16:38 +0200 User-Agent: KMail/1.11.4 (Linux/2.6.29-1-amd64; KDE/4.2.4; x86_64; ; ) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906181416.39314.toots@rastageeks.org> X-Spam: no; 0.00; uncaught:01 bug:01 otherlib:01 unixsupport:01 exn:01 exn:01 initialized:01 pointer:01 initialized:01 pointer:01 threads:01 threads:01 unix:01 unix:01 exception:01 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