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 258DE8015E for ; Sun, 11 Jun 2017 14:08:02 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=dra-news@metastack.com; spf=Pass smtp.mailfrom=dra-news@metastack.com; spf=None smtp.helo=postmaster@outmail149113.authsmtp.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of dra-news@metastack.com) identity=pra; client-ip=62.13.149.113; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of dra-news@metastack.com designates 62.13.149.113 as permitted sender) identity=mailfrom; client-ip=62.13.149.113; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.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@outmail149113.authsmtp.com) identity=helo; client-ip=62.13.149.113; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="postmaster@outmail149113.authsmtp.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AFrKVrB1U7KpVuv2vsmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?seMVKfad9pjvdHbS+e9qxAeQG96KtLQc06L/iOPJYSQ4+5GPsXQPItRndiQuro?= =?us-ascii?q?EopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZv?= =?us-ascii?q?JuTyB4Xek9m72/q89pDXYQhEniaxba9vJxiqsAvdsdUbj5F/Iagr0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us-ascii?q?I4/z07DIOmDZzfRo22m7yA3CK7HoVMaWxcC1CMF23od4SeVPsWZiKSOJwprjtR?= =?us-ascii?q?fLysW4IwnTyhsxX91fIzJ+7Z6msfs5byktRd6OjalBV0/jtxWZezyWaIGk19gG?= =?us-ascii?q?IEDxYy2Lt4uVQ1nluZ2O1+juNDPdle+/pSTg4xNtjXyOksWIO6YR7IYtrcEAXu?= =?us-ascii?q?ed6hGzxkEoM8?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0B0AAALMj1ZmHGVDT5dGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBFgEBAQMBAQEJAQEBgmWBKoENjn+PTgaBJ4I/hWuPaiyFeAKDAUMUAQE?= =?us-ascii?q?BAQEBAQEBAQESAQEBAQEICwsGKC9CDoFjDIJZAQEBAQIBJxM0CwULAgEIDgoNE?= =?us-ascii?q?RAhERMEAQ0CBA4FEgiJegMIBQkDAQuyfTqHQgMKhBUBAQEBAQEBAQIBAQEBAQE?= =?us-ascii?q?BAQEBAR2GG4JRgUd6NIJYgXwWg0KCMQWHbgyWCjuHK4c6hz+PK4tGiSY2gSswI?= =?us-ascii?q?SNdEgGFCYFydgGDZoY1AQEB?= X-IPAS-Result: =?us-ascii?q?A0B0AAALMj1ZmHGVDT5dGgEBAQECAQEBAQgBAQEBFgEBAQM?= =?us-ascii?q?BAQEJAQEBgmWBKoENjn+PTgaBJ4I/hWuPaiyFeAKDAUMUAQEBAQEBAQEBAQESA?= =?us-ascii?q?QEBAQEICwsGKC9CDoFjDIJZAQEBAQIBJxM0CwULAgEIDgoNERAhERMEAQ0CBA4?= =?us-ascii?q?FEgiJegMIBQkDAQuyfTqHQgMKhBUBAQEBAQEBAQIBAQEBAQEBAQEBAR2GG4JRg?= =?us-ascii?q?Ud6NIJYgXwWg0KCMQWHbgyWCjuHK4c6hz+PK4tGiSY2gSswISNdEgGFCYFydgG?= =?us-ascii?q?DZoY1AQEB?= X-IronPort-AV: E=Sophos;i="5.39,328,1493676000"; d="scan'208";a="227894141" Received: from outmail149113.authsmtp.com ([62.13.149.113]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jun 2017 14:07:57 +0200 Received: from mail-c247.authsmtp.com (mail-c247.authsmtp.com [62.13.128.247]) by punt24.authsmtp.com (8.14.2/8.14.2/) with ESMTP id v5BC7uBE047720; Sun, 11 Jun 2017 13:07:56 +0100 (BST) Received: from romulus.metastack.com (114.212-105-213.static.virginmediabusiness.co.uk [213.105.212.114]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id v5BC7r3q079598 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 11 Jun 2017 13:07:54 +0100 (BST) Received: from remus.metastack.local (remus.metastack.com [172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id v5BC7r3C011624; Sun, 11 Jun 2017 13:07:53 +0100 Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%10]) with mapi id 14.03.0351.000; Sun, 11 Jun 2017 13:07:52 +0100 From: David Allsopp To: Alexey Egorov CC: David Allsopp , "caml-list@inria.fr" Thread-Topic: [Caml-list] memory corruption using C stub Thread-Index: AQHS4f7ui67nCvnRhEeJyi0K29e8o6IfeYQAgAATD6r///GYgIAAFItZ Date: Sun, 11 Jun 2017 12:07:52 +0000 Message-ID: <69699CC5-7EF4-42FF-92DB-C065F412963C@metastack.com> References: <3064D48A-0481-4CB2-B208-2E61AA08920D@metastack.com>, In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MSL-Actually-To: dra-news@metastack.com Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 172.16.0.20 X-Server-Quench: 9995abdb-4e9e-11e7-b1e8-0015176ca198 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd1ZAARAlZZVg1f DC4bFwdFRBksPQFF ChxFJgxfNl8UURhQ KkJXbgASJgRFAnNE XXkJW1VTQFxyU2Ny YQ9VIwdcYVRPXwB0 UklLXFNTEBpqBAMA SFgbIGp1NQYHeHl5 YE9qEHhZVEY0fE90 Rx8GQT8bYTJpPX0e URVfalFVJQtXfh9E b1F4UiBcYGwPKBg1 TUcAFDk0OXBbKT9J d0kIIFcVW1dDFTkm XQ0aATQoGwUYXCQ1 IFQNYkUAAUx5 X-Authentic-SMTP: 61633634383431.1038:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 213.105.212.114/25 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. Subject: Re: [Caml-list] memory corruption using C stub On 11 Jun 2017, at 12:54, Alexey Egorov wrote: >=20 > OCaml side is a complex server-side application; unfortunately, it's > closed-source and when I'm trying to minimize OCaml side too it stops > crashing... Ah well! Are there other packages you are using which themselves have C stu= bs? If minimising the OCaml application is also eliminating the problem, th= en it could be that it's just the allocations in your (correct) C stub whic= h are revealing the crash elsewhere. Unfortunately, incorrect C stub can in= clude OCaml unix functions... Spattering Gc.full_major on the OCaml can help try to find corruptions earl= ier - have you tried that too? > I'm using fdopen's opam repository > (https://github.com/fdopen/opam-repository-mingw) with compiler's > versions from 4.03 to 4.05-beta3. I presume you're seeing the crash from all versions? Are you able to do a 4= .02.3 test, or is that impractical? David > 2017-06-11 16:45 GMT+05:00 David Allsopp : >>> On 11 Jun 2017, at 12:38, Alexey Egorov wrote: >>>=20 >>> OK, I'm minimized this function as much as possible and it's still >>> crashing - https://pastebin.com/MZ0Qkh9B >>> Now I'm thinking that is compiler's bug on windows... >>=20 >> Are you able to post the OCaml side of your minimised code? Which port o= f OCaml are you using? >>=20 >>=20 >> David >>=20 >>=20 >>> 2017-06-10 20:33 GMT+05:00 Alexey Egorov : >>>> Hello, >>>>=20 >>>> I have an OCaml application with some C code which (I believe) is the >>>> reason of some random crashes. >>>>=20 >>>> 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 =3D >>>> "compute_data_props" >>>>=20 >>>> 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. >>>>=20 >>>> 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. >>>>=20 >>>> Thanks! >>>=20 >>> -- >>> 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