From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Newsgroups: gmane.emacs.bugs Subject: bug#74547: 31.0.50; igc: assertion failed in buffer.c Date: Sun, 01 Dec 2024 16:18:31 +0100 Message-ID: References: <87serdu9m3.fsf@telefonica.net> <87cyibn0dz.fsf@protonmail.com> <875xo3mvqh.fsf@protonmail.com> <871pyrmui4.fsf@protonmail.com> <87wmgjlabu.fsf@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28276"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 74547@debbugs.gnu.org, =?UTF-8?Q?=C3=93scar?= Fuentes , geza.herman@gmail.com To: Pip Cet Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 01 16:21:37 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tHllQ-0007C6-Da for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Dec 2024 16:21:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHlk9-00028W-1s; Sun, 01 Dec 2024 10:20:19 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHljv-0001kt-E4 for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 10:20:06 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tHljv-0000Qb-4d for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 10:20:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=aiIY4o0BOyGpZllwCCWa+6r0EYNpuzrDbZgqfEz6JpM=; b=kEYCby51H2skFrDLt+/n6CaTK3iXIJMX5rLOuM2q5Tfi0ySf05fkfql6riaHY3euVK7uNwkM1vhOhk61euuZJ9zJZgJ5prmxdxj5DvE7ynn6lp9+4+cCVLQS7TDsz/6ZAYDasz4n2imF3ash7PAFA5SvHUSRx/wsYBeSkj5e/ZevEPnaZB4wXVP25maoH93k55QALCjZue2xjY9yBfBV/cGKVA6MSCUT3YxW+gPCaqtaFzAhFxNLL2b2/HscF6VxlFq49A/EEvS6Q/F9FnI4hZF/srqJPyZAvXqFx1rAulyhJLvFVqO1F1+UQMvynSOBTryEz03d0MjJlu8IYojBuQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHljt-0007GW-MQ for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 10:20:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Dec 2024 15:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74547 X-GNU-PR-Package: emacs Original-Received: via spool by 74547-submit@debbugs.gnu.org id=B74547.173306637927879 (code B ref 74547); Sun, 01 Dec 2024 15:20:01 +0000 Original-Received: (at 74547) by debbugs.gnu.org; 1 Dec 2024 15:19:39 +0000 Original-Received: from localhost ([127.0.0.1]:52642 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHljW-0007Fa-Iq for submit@debbugs.gnu.org; Sun, 01 Dec 2024 10:19:39 -0500 Original-Received: from mail-wm1-f44.google.com ([209.85.128.44]:49653) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHljT-0007FQ-6i for 74547@debbugs.gnu.org; Sun, 01 Dec 2024 10:19:37 -0500 Original-Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-434aa472617so28396075e9.3 for <74547@debbugs.gnu.org>; Sun, 01 Dec 2024 07:19:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733066314; x=1733671114; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aiIY4o0BOyGpZllwCCWa+6r0EYNpuzrDbZgqfEz6JpM=; b=TuVFbay7iXrgt4bWnyr+md2GxL5ahDiiGyaLH7G9ocztmJME5E171XpkGuTEN+Rli2 8PSS/V/Hb0EDW+0ZdDd/E+CpxHOK3JgWDsTc1cGg7bwINA/n9lPYS37AJqXGEp34jLO3 prEmczWdWAMHn7cP30OZy4zBIPf5PC5IqMd/125JO2AJOzbc2Td92hpxFiNcfDaSIXiL OgpHZYd1iw9qSR28x8ljRpMSUPCkdS/bUJrNs9xtmgK211R0YqN2o6uDOMQHv6WkeB7A NHNa5VsE1or6L5CaQtqqc8rt+2/CPpmU22IL5fM3Ndy5eIJG0VgN3a1I4xwwwCFXun61 HlHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733066314; x=1733671114; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=aiIY4o0BOyGpZllwCCWa+6r0EYNpuzrDbZgqfEz6JpM=; b=Z5nSaDNV3x2JaC+CXuZAuB2X3/4zNGt9KrVjmkQttnC1Qf1bom4OifsAzcisKFo+vc /EACewUc9eTHi/cqLyMdNFfAq+xFvjGM7MeyTk1R55ntQ0LGv4D0TEt6FCYKdJ7TSXKz V4AmAcJDP4YydEUsybMLwhqfy1cLMRQhhsIqwsOkDDMSxx6GjhyIqUFfozs/jprQL4Uw 5BHn4PGD/6XVHz7/vw2u2uC6kFA/C/RU9rLxNRYQDvz9c3wvRVwPA5i+okH3gQnuohC0 EVUf57JxHdFbQ5Qx8HipMD7mrw7j+ntiJd53/u88cvSus8zIdgUAPMc8TqS6rUPKI4/v MWnQ== X-Gm-Message-State: AOJu0Yz8kf0yZIHoyOfuvk0i3kj7M/f0WCl4ciAuSKSjhNoOfaG+9DnE 48jvER8YBd0wEKN0pMglQJy73VxAVpsoHj9eSM2QVapEV3sjO8Rv X-Gm-Gg: ASbGnct0TNSWuhjEYtdC/Td8dbCFD63N3EmROaRdZoD3v1E3j4vQtRDXxicC9HPCIgu geXjRMQB3gntpxqTSYF3+GhZsqB2tkcXkwD1qoEb8a7wfBXHFcV6PlyEITzcWd0Ox5D/tjANl9M EYWgcmj3KgEUOBS2U2sGykNzMtiib+7+kqwOa0+v07XV9miCooz4mN95xrEY7YiqBik5iE6gxzj 7kKNGwtNIB4mgyngLIiwZKJiaIL9+kRdgBnY3fI2T04bNC3/eqxYmWNBFdTjEYNkY+vocBV8Xpr RICkvFBS1tC2/Srz8FKlVzVqUuz7G9AtFpN3G04PJa2pNoQ8hdeFapb8Wg== X-Google-Smtp-Source: AGHT+IEh6Ww0x8zZKkd1whZCLDigM3pBrdQcbHhY2LDx5Wry78lJ5xlylxXqhkEWgCqLPYLCxFTlxA== X-Received: by 2002:a05:600c:5102:b0:432:d797:404a with SMTP id 5b1f17b1804b1-434a9de3947mr157775125e9.22.1733066314099; Sun, 01 Dec 2024 07:18:34 -0800 (PST) Original-Received: from pro2 (p200300e0b73e1e0079ddbf8403284f30.dip0.t-ipconnect.de. [2003:e0:b73e:1e00:79dd:bf84:328:4f30]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa763aaesm150495715e9.14.2024.12.01.07.18.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Dec 2024 07:18:32 -0800 (PST) In-Reply-To: <87wmgjlabu.fsf@protonmail.com> (Pip Cet's message of "Sun, 01 Dec 2024 14:58:10 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296256 Archived-At: Pip Cet writes: > Gerd M=C3=B6llmann writes: > >> Pip Cet writes: > >>> Gerd M=C3=B6llmann writes: >>>> Pip Cet writes: >>>> Yes, exactly, json.c. First thing I saw when searching for xfree >>>> >>>> static void >>>> json_parser_done (void *parser) >>>> { >>>> struct json_parser *p =3D (struct json_parser *) parser; >>>> if (p->object_workspace !=3D p->internal_object_workspace) >>>> xfree (p->object_workspace); >>>> >>>> That at least needs an explanation. I would have expected it to be >>>> allocated as root. >>> >>> Well, the explanation is this comment: >>> >>> /* Lisp_Objects are collected in this area during object/array >>> parsing. To avoid allocations, initially >>> internal_object_workspace is used. If it runs out of space then >>> we switch to allocated space. Important note: with this design, >>> GC must not run during JSON parsing, otherwise Lisp_Objects in >>> the workspace may get incorrectly collected. */ >> >> That explains it, indeed :-(. > > Just to be clear, I think the mixed heap/stack allocation is the right > thing to do here, but we need to let both garbage collectors know about > the Lisp_Objects we allocated. > > I think the best way to do that is to use a Lisp_Vector when we run out > of stack space. That way, we don't have to worry about forgetting to GC > it, and we can use standard functions rather than rolling our own. Yeah, I'd prefer using Lisp_Vectors too, and it was actually implemented at some point, but removed again, see https://yhetil.org/emacs-devel/87edc1rzig.fsf@gmail.com/ I vaguely remember a longer thread about GC in json.c at the time. Could be that that was before igc became a realistic possibility, don't remember. And yes, I've forgotten about it, and should actually have fixed this long ago :-).