GNU bug report logs - #40194
Weak sets keep growing

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Severity: important; Reported by: Ludovic Courtès <ludo@HIDDEN>; dated Mon, 23 Mar 2020 14:18:01 UTC; Maintainer for guile is bug-guile@HIDDEN.
Severity set to 'important' from 'normal' Request was from Ludovic Courtès <ludo@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 40194 <at> debbugs.gnu.org:


Received: (at 40194) by debbugs.gnu.org; 23 Mar 2020 21:57:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 23 17:57:43 2020
Received: from localhost ([127.0.0.1]:53644 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jGV4o-0000Da-Tj
	for submit <at> debbugs.gnu.org; Mon, 23 Mar 2020 17:57:43 -0400
Received: from eggs.gnu.org ([209.51.188.92]:53519)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1jGV4n-0000DN-5z
 for 40194 <at> debbugs.gnu.org; Mon, 23 Mar 2020 17:57:41 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:35406)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>)
 id 1jGV4h-00050S-VQ
 for 40194 <at> debbugs.gnu.org; Mon, 23 Mar 2020 17:57:36 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=43880 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>) id 1jGV4g-0006Lx-VY
 for 40194 <at> debbugs.gnu.org; Mon, 23 Mar 2020 17:57:35 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: 40194 <at> debbugs.gnu.org
Subject: Re: bug#40194: Weak sets keep growing
References: <87h7yfqho5.fsf@HIDDEN>
Date: Mon, 23 Mar 2020 22:57:33 +0100
In-Reply-To: <87h7yfqho5.fsf@HIDDEN> ("Ludovic
 \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\=
 \=\?utf-8\?Q\?s\?\= message of "Mon, 23 Mar 2020 15:17:46 +0100")
Message-ID: <87y2rqpwdu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 40194
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Ludovic Court=C3=A8s <ludo@HIDDEN> skribis:

> The size of the weak set keeps growing, even when GC happens.

Commit 02e3dc6ab95fe51786b68a8200322e163f8da478 mostly addresses it:

--8<---------------cut here---------------start------------->8---
$ ./meta/guile -s ~/src/guile-debugging/weak-set-growth.scm

;;; (10 #<weak-set 3517/7027>)

;;; (9 #<weak-set 10271/14051>)

;;; (8 #<weak-set 11711/14051>)

;;; (7 #<weak-set 9895/14051>)

;;; (6 #<weak-set 7697/14051>)

;;; (5 #<weak-set 11559/14051>)

;;; (4 #<weak-set 9220/14051>)

;;; (3 #<weak-set 6833/14051>)

;;; (2 #<weak-set 10637/14051>)

;;; (1 #<weak-set 8232/14051>)
--8<---------------cut here---------------end--------------->8---

It turns out that the core issue is that =E2=80=98vacuum_all_weak_sets=E2=
=80=99 is only
ever called a couple of times at the beginning of the execution, and
that=E2=80=99s it.

So it seems that the trick of =E2=80=98scm_i_register_async_gc_callback=E2=
=80=99 no
longer works as expected.

Thoughts?

Incidentally, in the reproducer I posted, if you insert (gc) after
(create-symbols), then the weak set grows a bit more!  Which makes me
wonder if we=E2=80=99re not leaking entries due to messed up disappearing l=
inks
or something.

Ludo=E2=80=99.




Information forwarded to bug-guile@HIDDEN:
bug#40194; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Mar 2020 14:17:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 23 10:17:52 2020
Received: from localhost ([127.0.0.1]:53364 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jGNto-0002sy-2y
	for submit <at> debbugs.gnu.org; Mon, 23 Mar 2020 10:17:52 -0400
Received: from lists.gnu.org ([209.51.188.17]:50825)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1jGNtm-0002sr-T9
 for submit <at> debbugs.gnu.org; Mon, 23 Mar 2020 10:17:51 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:38683)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>) id 1jGNtl-000465-U2
 for bug-Guile@HIDDEN; Mon, 23 Mar 2020 10:17:50 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:470:142:3::e]:53767)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>)
 id 1jGNtl-0007XT-Pf
 for bug-Guile@HIDDEN; Mon, 23 Mar 2020 10:17:49 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=42988 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>) id 1jGNtl-0002mq-8B
 for bug-Guile@HIDDEN; Mon, 23 Mar 2020 10:17:49 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: bug-Guile@HIDDEN
Subject: Weak sets keep growing
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 4 Germinal an 228 de la =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Mon, 23 Mar 2020 15:17:46 +0100
Message-ID: <87h7yfqho5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Hello,

Consider this code:

--8<---------------cut here---------------start------------->8---
(define (create-symbols)
  (let loop ((i 10000))
    (unless (zero? i)
      (gensym)
      (loop (1- i)))))

(let loop ((i 10))
  (unless (zero? i)
    (pk i (%symbols))
    (create-symbols)
    (loop (1- i))))
--8<---------------cut here---------------end--------------->8---

(You need to have the =E2=80=98%symbols=E2=80=99 procedure from libguile/sy=
mbols.c
compiled in.)

In 3.0.1+, it prints:

--8<---------------cut here---------------start------------->8---
;;; (10 #<weak-set 3517/7027>)

;;; (9 #<weak-set 10271/14051>)

;;; (8 #<weak-set 11625/28099>)

;;; (7 #<weak-set 21625/28099>)

;;; (6 #<weak-set 11090/56197>)

;;; (5 #<weak-set 21090/56197>)

;;; (4 #<weak-set 31090/56197>)

;;; (3 #<weak-set 41090/56197>)

;;; (2 #<weak-set 5052/112363>)

;;; (1 #<weak-set 15052/112363>)
--8<---------------cut here---------------end--------------->8---

The size of the weak set keeps growing, even when GC happens.

Conversely, weak tables shrink upon GC.

Ludo=E2=80=99.




Acknowledgement sent to Ludovic Courtès <ludo@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#40194; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 26 Apr 2020 17:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.