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 DF66280023 for ; Mon, 10 Oct 2016 15:38:55 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=francois.bobot@cea.fr; spf=None smtp.mailfrom=francois.bobot@cea.fr; spf=None smtp.helo=postmaster@sainfoin-out.extra.cea.fr Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of francois.bobot@cea.fr) identity=pra; client-ip=132.167.192.145; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="francois.bobot@cea.fr"; x-sender="francois.bobot@cea.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of francois.bobot@cea.fr) identity=mailfrom; client-ip=132.167.192.145; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="francois.bobot@cea.fr"; x-sender="francois.bobot@cea.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@sainfoin-out.extra.cea.fr) identity=helo; client-ip=132.167.192.145; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="francois.bobot@cea.fr"; x-sender="postmaster@sainfoin-out.extra.cea.fr"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AJaKYkxR/G8Oe8rZmaDNIC9po99psv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa64ZxCN2/xhgRfzUJnB7Loc0qyN4vqmAjxLv8/JmUtBWaQEbwUCh8?= =?us-ascii?q?QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYsExnyfTB4?= =?us-ascii?q?Ov7yUtaLyZ/mjabpq9aNOk1hv3mUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO?= =?us-ascii?q?9MxGlldhq5lhf44dqsrtY4q3wD86Fpy8kVWqz/e+E8TKdEJDUgKWE8osPx5jfZ?= =?us-ascii?q?Sg7ayGEVVOoRkwF/KQ/P6w2yCpnruy3xsetmniOdN8rqZbs5UHKs9fE4G1fTlC?= =?us-ascii?q?4bOmthoynsgctqgfcDrQ=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0BTAQDVmPtXh5HAp4RZGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBFwEBBAEBCgEBgxEBAQEBAXQqUqQ2lDGCCyaFegKCDTkTAQEBAQEBAQE?= =?us-ascii?q?BAQESAQEBCgsJCRkvgjIYghcBAQEDASMECwEFRgsLGAICJgICVxMIAohECA60a?= =?us-ascii?q?YxXAQoBAQEkgQeHM4FTgQWEF3yCOIJbBZl/XoVJjBKHLYYLjHeDfx8Bg3uBYHA?= =?us-ascii?q?BhR8qggUBAQE?= X-IPAS-Result: =?us-ascii?q?A0BTAQDVmPtXh5HAp4RZGgEBAQECAQEBAQgBAQEBFwEBBAE?= =?us-ascii?q?BCgEBgxEBAQEBAXQqUqQ2lDGCCyaFegKCDTkTAQEBAQEBAQEBAQESAQEBCgsJC?= =?us-ascii?q?RkvgjIYghcBAQEDASMECwEFRgsLGAICJgICVxMIAohECA60aYxXAQoBAQEkgQe?= =?us-ascii?q?HM4FTgQWEF3yCOIJbBZl/XoVJjBKHLYYLjHeDfx8Bg3uBYHABhR8qggUBAQE?= X-IronPort-AV: E=Sophos;i="5.31,324,1473112800"; d="scan'208";a="196252614" Received: from sainfoin-out.extra.cea.fr ([132.167.192.145]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Oct 2016 15:38:48 +0200 Received: from pisaure.intra.cea.fr (pisaure.intra.cea.fr [132.166.88.21]) by sainfoin.extra.cea.fr (8.15.2/8.15.2/CEAnet-Internet-out-2.4) with ESMTP id u9ADclsg030372 for ; Mon, 10 Oct 2016 15:38:47 +0200 Received: from pisaure.intra.cea.fr (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 92EB520890C for ; Mon, 10 Oct 2016 15:38:47 +0200 (CEST) Received: from muguet2.intra.cea.fr (muguet2.intra.cea.fr [132.166.192.7]) by pisaure.intra.cea.fr (Postfix) with ESMTP id 8887420890B for ; Mon, 10 Oct 2016 15:38:47 +0200 (CEST) Received: from [10.8.32.80] (is222783.intra.cea.fr [10.8.32.80]) by muguet2.intra.cea.fr (8.15.2/8.15.2/CEAnet-Intranet-out-1.4) with ESMTP id u9ADclSS013369 for ; Mon, 10 Oct 2016 15:38:47 +0200 To: caml-list@inria.fr References: <57FB9441.3060703@inria.fr> From: =?UTF-8?Q?Fran=c3=a7ois_Bobot?= Message-ID: <2eb2cf19-6ad8-ee9d-9b76-a71c0d5ed7c2@cea.fr> Date: Mon, 10 Oct 2016 15:38:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.2.0 MIME-Version: 1.0 In-Reply-To: <57FB9441.3060703@inria.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] Ephemerons: is this behavior correct ? Hi Bertrand, On 10/10/2016 15:14, Bertrand Jeannet wrote: > The following piece of code raises an assert false exception (in rare > cases) with official version 4.03.0: > > match Ephemeron.K1.get_data c with > | Some _ -> > match Ephemeron.K1.get_key c with > | Some _ -> (* ... *) > | None -> assert false (* reachable *) > > The documentation of the Ephemeron module says: > "When one of the keys is not considered alive anymore by the GC, the > data is emptied from the ephemeron" > > I was expecting this to happen atomically from the programmer point of > view, Yes, atomicity is the intent. > but here apparently the key was emptied but the data kept (at > least temporarily). I don't deduce that from the example. The cleaning can be done atomically between the return of get_data and the return of get_key (indeed get_key does an allocation). An example that would show non-atomicity would be: > match Ephemeron.K1.get_data c with > | None -> > match Ephemeron.K1.get_key c with > | Some _ -> assert false (* non atomic! *) > | None -> ... > or > match Ephemeron.K1.get_key c with > | None -> > match Ephemeron.K1.get_data c with > | Some _ -> assert false (* non atomic! *) > | None -> ... > > > Was this behavior anticipated ? Yes. > > IMHO, synchronized deletion is simpler and safer (in previous versions, > I encountered the now-solved-bug that the deletion of several weak > pointers to the same object was not synchronized). Indeed I think it is a better behavior. I'm happy it solved your previous problems. > > Btw, the Ephemeron module does not appear on this url: > http://caml.inria.fr/pub/docs/manual-ocaml/stdlib.html > one has to go to > http://caml.inria.fr/pub/docs/manual-ocaml/libref/index.html I though that GPR#564[1] merged in 4.03 took care of this bug, so I don't understand. Best, [1]: https://github.com/ocaml/ocaml/pull/564 -- François