From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 96D0A80160 for ; Sat, 10 Jun 2017 17:40:54 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=vietlq85@gmail.com; spf=Pass smtp.mailfrom=vietlq85@gmail.com; spf=None smtp.helo=postmaster@mail-yb0-f170.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of vietlq85@gmail.com) identity=pra; client-ip=209.85.213.170; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="vietlq85@gmail.com"; x-sender="vietlq85@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of vietlq85@gmail.com designates 209.85.213.170 as permitted sender) identity=mailfrom; client-ip=209.85.213.170; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="vietlq85@gmail.com"; x-sender="vietlq85@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-yb0-f170.google.com) identity=helo; client-ip=209.85.213.170; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="vietlq85@gmail.com"; x-sender="postmaster@mail-yb0-f170.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AZR5vAxWOuE2jv0Y1vNV6aDHdyV7V8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYbBeCt8tkgFKBZ4jH8fUM07OQ6PG/HzRYqb+681k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRo?= =?us-ascii?q?LerpBIHSk9631+ev8JHPfglEnjSwbLdwIRmssQndqt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?us-ascii?q?t66CtoJpihCNL9R42xyJiMlHOlH5BKYnkWV3iDFH7pc8OPXPJaO3HaGdNojjFR?= =?us-ascii?q?DevpcIQmzxz76F73?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AfDAAiEjxZhqrVVdFcHAEXAQYBCwEXA?= =?us-ascii?q?QYBg0Q/gQ2DdIE2mlCCP4sUhQaFOyyFeAKDAUIVAQEBAQEBAQEBAQESAQEBCAs?= =?us-ascii?q?LCCgvQg4BgWIMgloBAgIBIwQZARsSDAMBCwYFBAcDFx0CAiEBAREBBQEKBAENB?= =?us-ascii?q?gESEooBAQMNCBClKj+MCIFsGAUBHIMKBYNpChknAwpWR4J4AQEBBwEBAQEBAQE?= =?us-ascii?q?BGAIGEosbNIJYgj+CZYJhBYEsAQGGQAyBWo02hnoxCAEBgUcKhVqHOoRkgluBD?= =?us-ascii?q?o4di0aHXjOBFQ8mgSx0XRlbhCiBckA2AYUOhGQBAQE?= X-IPAS-Result: =?us-ascii?q?A0AfDAAiEjxZhqrVVdFcHAEXAQYBCwEXAQYBg0Q/gQ2DdIE?= =?us-ascii?q?2mlCCP4sUhQaFOyyFeAKDAUIVAQEBAQEBAQEBAQESAQEBCAsLCCgvQg4BgWIMg?= =?us-ascii?q?loBAgIBIwQZARsSDAMBCwYFBAcDFx0CAiEBAREBBQEKBAENBgESEooBAQMNCBC?= =?us-ascii?q?lKj+MCIFsGAUBHIMKBYNpChknAwpWR4J4AQEBBwEBAQEBAQEBGAIGEosbNIJYg?= =?us-ascii?q?j+CZYJhBYEsAQGGQAyBWo02hnoxCAEBgUcKhVqHOoRkgluBDo4di0aHXjOBFQ8?= =?us-ascii?q?mgSx0XRlbhCiBckA2AYUOhGQBAQE?= X-IronPort-AV: E=Sophos;i="5.39,324,1493676000"; d="scan'208,217";a="227852536" Received: from mail-yb0-f170.google.com ([209.85.213.170]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 10 Jun 2017 17:40:53 +0200 Received: by mail-yb0-f170.google.com with SMTP id o9so20543669yba.3 for ; Sat, 10 Jun 2017 08:40:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=dQV/xzKwiEYZxR0Abr47pCb/r/UVcuBDSKiRuSgLcpY=; b=Ce3sFI8MZLPN/zEO+ouhgNECtQAQNx73ZBvaTOZeADGFie/I8agJEqiJaSSlI9Sk/i zYOblcAv4BIsLGI60RHR6M9zOqEUtqoEJKZCxAR3LMslLV8BpOQC7iPhQZfjVcG94yb3 PuuUIDo1WE88T8ek7khpeSY5/1lKw/ikIfwCK2UHnLedXkW6vimH3V+ES2GezBBHDGp0 8l2d27ldeDHOelPL3JWKxLAhOyR3H13o+w5lg8Mfqr56v2BU13judRBeHXUxAhzK7ZwM fbw441XIW7EzfJyJm8/SWMM8pxl0LWkdZaCZnjxYNHRvHZss7AWulRKabLvJyTvNwTxX ZlaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=dQV/xzKwiEYZxR0Abr47pCb/r/UVcuBDSKiRuSgLcpY=; b=gkaYy1NQYmKdBBdX3ZsLe5qdnOQNGzadfA0adIU6U1de5cOlkwO2xTS7qghrKpLDN9 toSZzTKrnsNkod1iMYSn6HpZzZSi9hehDwxJwwXRaHQJVY8PqtbGaWe0T8PpQDBcGbLu x+sm3DCR9tf7wsmaouueFGkWvEjBR69LfM5j2HY1nt6+5EOCf6L/t8m0opWR9QYzUBU4 AEBLgLw9P8uSdLMBArHjFMoHFr4xWKqiH0fbynRlKleiurx2MwCgv3BiX2dCvzCX3eFi JVO984k4GnbBA4e2yoa9k0Jzg2mWWqkQADeHCbwh6GfH2z6HhA60IRD0D3qhaJdOMQN7 oeGA== X-Gm-Message-State: AODbwcAVYq8h9Vopab+PiXbaYCb5TTSbMV8R7oQveRqXpCsGcAKATqwW ExC59PgXQY5nSKmQId+DZMLHQBevGw== X-Received: by 10.37.203.21 with SMTP id b21mr18833171ybg.209.1497109252047; Sat, 10 Jun 2017 08:40:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Viet Le Date: Sat, 10 Jun 2017 15:40:41 +0000 Message-ID: To: Alexey Egorov , caml-list@inria.fr Content-Type: multipart/alternative; boundary="94eb2c05bdd8288e9c05519ce960" Subject: Re: [Caml-list] memory corruption using C stub --94eb2c05bdd8288e9c05519ce960 Content-Type: text/plain; charset="UTF-8" Do you have stack frame to look at? On Sat, 10 Jun 2017 at 16:33, Alexey Egorov wrote: > Hello, > > I have an OCaml application with some C code which (I believe) is the > reason of some random crashes. > > Here is the code - https://pastebin.com/FVtLphZu > This function reads file at given offset, divides data into chunks and > compute checksums and compression ratio: > external compute_data_props > : string -> int -> int -> int -> (int * int * float) list = > "compute_data_props" > > The problem is, after some calls to this stub, application is crashing > at random places in OCaml code. > I can't figure out what's going wrong, but replacing this stub with > dummy function (which does nothing but returns some predefined list) > eliminates the problem. > > What can we do to debug it? We are using OCaml 4.04.1 and Windows 10, > and there is no other C stubs in our codebase. > > Thanks! > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- Kind regards, Viet --94eb2c05bdd8288e9c05519ce960 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Do you have stack frame to look at?


On Sat, 10 Jun 2017 at 16:33, Alexey Egorov <= alex.only.d@gmail.com> wrot= e:
Hello,

I have an OCaml application with some C code which (I believe) is the
reason of some random crashes.

Here is the code - https://pastebin.com/FVtLphZu
This function reads file at given offset, divides data into chunks and
compute checksums and compression ratio:
=C2=A0 external compute_data_props
=C2=A0 =C2=A0 : string -> int -> int -> int -> (int * int * flo= at) list =3D
"compute_data_props"

The problem is, after some calls to this stub, application is crashing
at random places in OCaml code.
I can't figure out what's going wrong, but replacing this stub with=
dummy function (which does nothing but returns some predefined list)
eliminates the problem.

What can we do to debug it? We are using OCaml 4.04.1 and Windows 10,
and there is no other C stubs in our codebase.

Thanks!

--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocam= l_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
--
Kind regards,
Viet=
--94eb2c05bdd8288e9c05519ce960--