caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mark Shinwell <mshinwell@janestreet.com>
To: Paul Steckler <steck@stecksoft.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Segfaults with Dynlink with OCaml 3.11
Date: Mon, 23 Aug 2010 13:05:03 +0100	[thread overview]
Message-ID: <20100823120503.GH27059@janestreet.com> (raw)
In-Reply-To: <AANLkTikXgXz67h3kdUkFqa7=sAzFJQH7orceV65zd1uo@mail.gmail.com>

On Mon, Aug 23, 2010 at 09:47:43PM +1000, Paul Steckler wrote:
> On Mon, Aug 23, 2010 at 9:06 PM, Stéphane Glondu <steph@glondu.net> wrote:
> > Does your real large program use C bindings? Are you able to reproduce
> > the segfaults with pure OCaml code?
> 
> Yes, the large program has C bindings, including calls into dynamically loaded
> .so files (Linux dynamic libraries).  Anything I should look into for those?

It can be a time-consuming task, but double-check all the rules on
http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html are being followed.
For example, watch out for things like variables of type [value] that are
wrongly not protected with CAMLlocal/CAMLparam macros across allocation points
when the variable's contents are needed later, uses of the Field macro as an
lvalue in a situation where instead Store_field must be used, assigning to
generational global roots without using the correct function, etc.  Just one
minor transgression could be the cause of a hard-to-find error at some random
point during program execution.

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.

Mark


  reply	other threads:[~2010-08-23 12:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-23 10:57 Paul Steckler
2010-08-23 11:06 ` [Caml-list] " Stéphane Glondu
2010-08-23 11:47   ` Paul Steckler
2010-08-23 12:05     ` Mark Shinwell [this message]
2010-08-23 12:12       ` Paul Steckler
2010-08-23 12:15         ` Daniel Bünzli
2010-08-23 12:28         ` Anil Madhavapeddy
2010-08-23 15:48         ` Stéphane Glondu
2010-08-25  4:00 ` Paul Steckler
2010-09-03 14:59   ` [Caml-list] " Damien Doligez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100823120503.GH27059@janestreet.com \
    --to=mshinwell@janestreet.com \
    --cc=caml-list@inria.fr \
    --cc=steck@stecksoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).