From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 1D58DBBAF for ; Mon, 23 Aug 2010 14:28:56 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsEAKcGckxZELGa/2dsb2JhbAChIbkAhTcEiXY X-IronPort-AV: E=Sophos;i="4.56,257,1280700000"; d="scan'208,217";a="66003329" Received: from recoil.dh.bytemark.co.uk (HELO dark.recoil.org) ([89.16.177.154]) by mail1-smtp-roc.national.inria.fr with SMTP; 23 Aug 2010 14:28:55 +0200 Received: (qmail 15490 invoked by uid 634); 23 Aug 2010 12:28:55 -0000 X-Spam-Level: * X-Spam-Check-By: dark.recoil.org Received: from no-dns-yet.demon.co.uk (HELO [192.168.14.21]) (62.49.66.12) (smtp-auth username remote@recoil.org, mechanism cram-md5) by dark.recoil.org (qpsmtpd/0.83) with ESMTPA; Mon, 23 Aug 2010 13:28:55 +0100 Subject: Re: [Caml-list] Segfaults with Dynlink with OCaml 3.11 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/alternative; boundary=Apple-Mail-1--683344773 From: Anil Madhavapeddy In-Reply-To: Date: Mon, 23 Aug 2010 13:28:53 +0100 Cc: Mark Shinwell , caml-list@inria.fr Message-Id: <0E8825B8-E57B-4704-879A-045CC5E1CCA3@recoil.org> References: <4C725620.4070803@glondu.net> <20100823120503.GH27059@janestreet.com> To: Paul Steckler X-Mailer: Apple Mail (2.1081) X-Virus-Checked: Checked by ClamAV on dark.recoil.org X-Spam: no; 0.00; segfaults:01 dynlink:01 ocaml:01 anil:01 anil:01 steckler:01 shinwell:01 gdb:01 backtrace:01 segfaults:01 dynlink:01 gdb:01 segfault:01 ocaml's:01 runtime:01 --Apple-Mail-1--683344773 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 23 Aug 2010, at 13:12, Paul Steckler wrote: > On Mon, Aug 23, 2010 at 10:05 PM, Mark Shinwell > wrote: >=20 >> Have you tried using gdb to determine the stack backtrace when it = segfaults? >> Also, if it can be done without disturbing too much code, it might be = worth >> trying to eliminate Dynlink from the program as a test. >=20 > I've already tried gdb, which is how I learned that the segfault > occurs during a call > to one of the query functions in my glue module. >=20 > Oh, we just added the Dynlink stuff. There haven't been any recent > crashes until > just now. That could be an unhappy coincidence; the real issue might > lurk in unrelated > code, as you point out. >=20 OCaml's runtime library also has a debug version which performs = additional integrity checks on the heap during garbage collection and = other operations. This can help catch problems much closer to their = source than the production version of the library. I build it by: $ cd ocaml-3.11.2/ $ ./configure $ cd asmrun $ make libasmrund.a $ cp libasmrund.a /opt/local/lib/ocaml/ Then I swap the installed libasmrun.a with libasmrund.a when a debug = version is needed, and replace the original when done. Regularly = calling Gc.compact() helps triggers the additional checks more often. I'm not sure if there is a way of using the debug version more easily = --- libasmrunp.a (the profiling version) is installed by default, but = libasmrund.a is not. -anil --Apple-Mail-1--683344773 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
On = Mon, Aug 23, 2010 at 10:05 PM, Mark Shinwell
<mshinwell@janestreet.com> = wrote:

Have you tried = using gdb to determine the stack backtrace when it = segfaults?
Also, if it can be = done without disturbing too much code, it might be = worth
trying to eliminate = Dynlink from the program as a test.

I've already = tried gdb, which is how I learned that the segfault
occurs during a = call
to one of the query functions in my glue module.

Oh, we = just added the Dynlink stuff.  There haven't been any = recent
crashes until
just now.  That could be an unhappy = coincidence; the real issue might
lurk in unrelated
code, as you = point out.


OCaml's runtime = library also has a debug version which performs additional integrity = checks on the heap during garbage collection and other operations. This = can help catch problems much closer to their source than the production = version of the library.  I build it by:

$ = cd ocaml-3.11.2/
$ ./configure <usual args>
$ = cd asmrun
$ make libasmrund.a
$ cp libasmrund.a = /opt/local/lib/ocaml/

Then I swap the installed = libasmrun.a with libasmrund.a when a debug version is needed, and = replace the original when done.  Regularly calling Gc.compact() = helps triggers the additional checks more = often.

I'm not sure if there is a way of using = the debug version more easily --- libasmrunp.a (the profiling version) = is installed by default, but libasmrund.a is = not.

-anil

= --Apple-Mail-1--683344773--