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 B91AC8015E for ; Sun, 11 Jun 2017 17:26:36 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=alex.only.d@gmail.com; spf=Pass smtp.mailfrom=alex.only.d@gmail.com; spf=None smtp.helo=postmaster@mail-io0-f172.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of alex.only.d@gmail.com) identity=pra; client-ip=209.85.223.172; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alex.only.d@gmail.com"; x-sender="alex.only.d@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of alex.only.d@gmail.com designates 209.85.223.172 as permitted sender) identity=mailfrom; client-ip=209.85.223.172; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alex.only.d@gmail.com"; x-sender="alex.only.d@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-io0-f172.google.com) identity=helo; client-ip=209.85.223.172; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alex.only.d@gmail.com"; x-sender="postmaster@mail-io0-f172.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AxCkBwBbFFSQzw9MVTalaTFP/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZr8u7bnLW6fgltlLVR4KTs6sC0LuJ9fi4EUU7or+5+EgYd5JNUxJXwe?= =?us-ascii?q?43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRp?= =?us-ascii?q?OOv1BpTSj8Oq3Oyu5pHfeQtFiT6/bL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+?= =?us-ascii?q?RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPC?= =?us-ascii?q?TQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjul8qlrVQToiD?= =?us-ascii?q?8ZODEl7GHZhMtwjKdBrxKgoRx03orYbY6ROfZ7eK7WYNEUSndbXstJVSNBDIOy?= =?us-ascii?q?YYUMAeQcI+hXs4bzqkASrRunHwSgGP/jxiNKi3LwwKY00/4hEQbD3AE4A98OtG?= =?us-ascii?q?rbrdrrO6YSTOu7w6bIzTLZb/NRxzf29Y/FfQolof6SUrN8a83RyU8rFwLFlFmf?= =?us-ascii?q?tJfoPzyQ1usXsmib6/BsWv6oi24isgx8pCWkyMkrionMnI0Vy1bE+D14wIYzP9?= =?us-ascii?q?24SVR0bcSqEJtKry2aL5F5Qtg+Q252oyk6y7sGtYSncygNzZQr3xHfa/2bc4iI?= =?us-ascii?q?/xLsT/ydLit/hHJgYL6+hwy98Uinyu37TMW7zFFKri9Dn9LRtX4NzwTe5tabRv?= =?us-ascii?q?Z55Eus2jaC2xrN5u1aL004j7fXJpw/zrM2i5Edq17MHjXsl0XzlKKWdlsr+uyv?= =?us-ascii?q?6+n/Z7XpvJ6cN4tthgH/NaQihtWzAeolPgUMQWSX4+u81Lrk/U32RLVFkOc6nb?= =?us-ascii?q?XesJDfPcgbp6i5DBFJ0os79RqzEzOr3M4bkHQHNl5JZgyLgobzN13TIv30E++z?= =?us-ascii?q?g1G2nzdqw/DGMKfhApLILnXbirjheahy6kFGxAo0y9Bf45JVBqscL//oVU/xsc?= =?us-ascii?q?bXDh49MwCu3+nnD9B92psEWW2TGq+ZLL/SsViQ6+0zOeaMYYsVtC/5K/gk/P7u?= =?us-ascii?q?kWQ0mUQdfKmsxZsYcmq0HvVgI0WDYHrjmM0NEWkQvll2cOu/pFScUDIbTnK2RK?= =?us-ascii?q?Uk/nlvBJivSIHOWZuFhbGd1TynF5ZVIGtBDwbfP23vctCtX/ocZTPaD8BmiDsa?= =?us-ascii?q?HeyoT4IxkxaosB68x5JoK+PV/msTspe1h4s93PHaiRxnrW88NM+ayWzYEzB5?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AOAgAeYD1Zf6zfVdFdHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBhA+BDQeDbZwGgj+TRIIRIQuFdAICAoJ6B0EWAQEBAQEBAQEBAQE?= =?us-ascii?q?SAQEJCwsIJjGCMwyCWQEBAQECAQEiBBkBGxILAQMBCwYFCwMKAgIJHQICIQEBE?= =?us-ascii?q?QEFAQoEAQ0GExIIiXkBAwgFCBCkGT+MCIFsGAUBHIMKBYNpChknAwpWgz8BAQE?= =?us-ascii?q?BAQEEAQEBAQEBARkCBhJ5hERMhRI0gliBfBaDEoJhBYduDIlDjEc7hyuHOoRkg?= =?us-ascii?q?luPK4tGh14UH4EVJgWBNjAhI10ZhGSCGDk2AYobAQEB?= X-IPAS-Result: =?us-ascii?q?A0AOAgAeYD1Zf6zfVdFdHAEBBAEBCgEBFwEBBAEBCgEBhA+?= =?us-ascii?q?BDQeDbZwGgj+TRIIRIQuFdAICAoJ6B0EWAQEBAQEBAQEBAQESAQEJCwsIJjGCM?= =?us-ascii?q?wyCWQEBAQECAQEiBBkBGxILAQMBCwYFCwMKAgIJHQICIQEBEQEFAQoEAQ0GExI?= =?us-ascii?q?IiXkBAwgFCBCkGT+MCIFsGAUBHIMKBYNpChknAwpWgz8BAQEBAQEEAQEBAQEBA?= =?us-ascii?q?RkCBhJ5hERMhRI0gliBfBaDEoJhBYduDIlDjEc7hyuHOoRkgluPK4tGh14UH4E?= =?us-ascii?q?VJgWBNjAhI10ZhGSCGDk2AYobAQEB?= X-IronPort-AV: E=Sophos;i="5.39,329,1493676000"; d="scan'208";a="227901601" Received: from mail-io0-f172.google.com ([209.85.223.172]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 11 Jun 2017 17:26:35 +0200 Received: by mail-io0-f172.google.com with SMTP id t87so27278316ioe.0 for ; Sun, 11 Jun 2017 08:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=AektO6A+0PqPzlLJ0VQTEYHdKs5Z81Zv0+F34JKmI7Y=; b=Nc4nGk5C/oZI4iO5jJxewrSEG5rpjprIhuEW6wMn51cKklz4x4WPgATma45tpjsfS1 b8xO6cQza5CbRidn+ym9BqYqZ5g77G6C28Q/yH1ACMsHlc0XGkP4l1x7mGQzXENOk72C Fe2Q2zB4HNiBL3rDHx0JdZrHwmYLWgACCXMi+v2fdPem4g7YIHJZetkA+IPHs0VNHKFv wnvMrhk+40/RitP7hUZBl3aBdjseHzL1cVYuby4RDlj0PJPZ0RZNtS+ZuqWFBjqsHpNe PQU1K+T5/CZ1FJ16Q/bYdXmER+SG5aQWcdkh12sscXOIpjb6/9WSYzgbCVWLJqTVBO7D LtYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=AektO6A+0PqPzlLJ0VQTEYHdKs5Z81Zv0+F34JKmI7Y=; b=prA+SPtdFuAQi1OPqlKjLd3zeZf/8gHy9KgWZ0afWHl6wP16RsDp+VLbQV8XTvrmBc wDj8TbL3eJikQqkjACaASw2L+ZG2i2OHkjD50LsFE6IWDkmzSC+PWbwmwSVofeT+YOnX 01zKftu83sZGu3vY2CAKgDg5Wwc5msnqae+307qXN0fMQcOJLD5GobM5EVBSM1cFFv/h RHstGDaoRVgNtnOQSPhoA5gkv6vm15JWmvtZAoeZjqwxgBxNpLM2pKmRA5wo5P87TJkd r807NZtFcHMquwTnO7+UNqG6HDMroDYL/6sORmz8yMi7E4PyVqF0PjIjEtusZ0N6tDiI TNMA== X-Gm-Message-State: AODbwcBsxhxOuY0EtjkQ+GCsX+9IVN3+vOBC2mJiPUpKudaRWs3AVUO4 K8ibsiBYxcx8me1BGSIIBfp5HAcI49zs X-Received: by 10.107.29.65 with SMTP id d62mr14450180iod.114.1497194794142; Sun, 11 Jun 2017 08:26:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.151.19 with HTTP; Sun, 11 Jun 2017 08:26:33 -0700 (PDT) In-Reply-To: <69699CC5-7EF4-42FF-92DB-C065F412963C@metastack.com> References: <3064D48A-0481-4CB2-B208-2E61AA08920D@metastack.com> <69699CC5-7EF4-42FF-92DB-C065F412963C@metastack.com> From: Alexey Egorov Date: Sun, 11 Jun 2017 20:26:33 +0500 Message-ID: To: David Allsopp Cc: "caml-list@inria.fr" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] memory corruption using C stub > Are there other packages you are using which themselves have C stubs? No, except maybe stubs in Array and Unix modules (we are using lots of Unix.create_process and related functions). You are right, our C stub is correct - I increased a load on application and it crashes even without calling this C function... > I presume you're seeing the crash from all versions? Are you able to do a= 4.02.3 test, or is that impractical? Yes, app crashes in all versions. I tried 4.02.3 - still crashing :( 2017-06-11 17:07 GMT+05:00 David Allsopp : > On 11 Jun 2017, at 12:54, Alexey Egorov wrote: >> >> 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 s= tubs? If minimising the OCaml application is also eliminating the problem, = then it could be that it's just the allocations in your (correct) C stub wh= ich are revealing the crash elsewhere. Unfortunately, incorrect C stub can = include OCaml unix functions... > > Spattering Gc.full_major on the OCaml can help try to find corruptions ea= rlier - 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: >>>> >>>> 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... >>> >>> Are you able to post the OCaml side of your minimised code? Which port = of OCaml are you using? >>> >>> >>> David >>> >>> >>>> 2017-06-10 20:33 GMT+05:00 Alexey Egorov : >>>>> 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 =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. 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