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 14:30:37 +0100 Message-ID: References: <87serdu9m3.fsf@telefonica.net> <87cyibn0dz.fsf@protonmail.com> <875xo3mvqh.fsf@protonmail.com> <871pyrmui4.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="6815"; 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 14:32:52 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 1tHk4C-0001d4-68 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Dec 2024 14:32:52 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHk3k-0003j9-5C; Sun, 01 Dec 2024 08:32:24 -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 1tHk3Q-0003hz-CQ for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 08:32:07 -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 1tHk3O-0006fV-UH for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 08:32: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=7pSFgKKhQyeaKJWxkO1KU7UkGRUq8TiHilyMTiENkg8=; b=VdGjIAxQDJAxQUeUv/+/EYBLz/NYgFMKx3dpmWInCZY1t4y2szMe8DA1g/Ypgre7JWxBZgrUQF81E+HY7a7kzfWHspaVdR55MuBrmeEqx9bdugLkFwb6BRZqKp+2oNZL5G1lTEeCOuyAYsFtHG0PCR9w9SLZW6bLrC812BR2G1iPrnnUfI8ztfcf5XUOqECW21tEMCwFvXIwCiIkhziGrEK1KcZE/7qGb26OqiBWCWRKlsDtHoHV35pCwRFLbo/GY+DfUrJdPjnN+BZq5bJV97l86VQyQ50pem6jCw2197ztItoqnghN2UDwGoYDTGQWNACJaiiekeNmZnAP1hOXgA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHk3N-0001Aw-Om for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 08:32: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 13:32: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.17330599084493 (code B ref 74547); Sun, 01 Dec 2024 13:32:01 +0000 Original-Received: (at 74547) by debbugs.gnu.org; 1 Dec 2024 13:31:48 +0000 Original-Received: from localhost ([127.0.0.1]:50710 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHk3A-0001AO-5M for submit@debbugs.gnu.org; Sun, 01 Dec 2024 08:31:48 -0500 Original-Received: from mail-wm1-f43.google.com ([209.85.128.43]:54437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHk37-0001A2-A9 for 74547@debbugs.gnu.org; Sun, 01 Dec 2024 08:31:46 -0500 Original-Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-434ab114753so27692205e9.0 for <74547@debbugs.gnu.org>; Sun, 01 Dec 2024 05:31:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733059839; x=1733664639; 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=7pSFgKKhQyeaKJWxkO1KU7UkGRUq8TiHilyMTiENkg8=; b=SJwoBf78tXcKsMqrcoMj1d92Cru3s7G5S6PefnE4d5hULP1AmOP6mAG4ThwnhIM123 BuzQh1uipkI2h//cYvqc/77v9oYCnqHvsplftHWm7zLD/hvlEeCMkuSGHD4raqQWfmmu Ir8bBZSUiWPJuihHT4+zdkGoVYewAnaimJEOZy2aKok/4bVCs5u8SCReLXhTQ2UF5Z4B t/zjGLjmCmxfPYrjktIrHSp7H/vjzyXq7yAI2S/bvXqEBapliW84LhyFqunMF+9yjU08 VScT1IYT+Veel7GFraiCPJDmnxdpuxbYYhCsRjd5hGP17dmC1BGIzdsqHTQX7OWYes+4 ZIsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733059839; x=1733664639; 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=7pSFgKKhQyeaKJWxkO1KU7UkGRUq8TiHilyMTiENkg8=; b=vC9TOuP0OWMaELPCcaxjc+my/5q/zKB5cRIb0BmFAO20q1i67AN8jZkRBteItUfpV0 1K+uJ0eROXmNhDVxZkvuFouzZqkOrL5ycy5jyTNscp8gpB6nVIewQXAsw5uV+ZUrMCL5 n5Q8f6o6u/ojYj8sNeUeENtcW9It78A8cfkK28ihPgdhQ6rscASa2vNAFLc68nVkJRbh Q+rQbSupd2G/f97X3msT1AIGZPw9OeJbGd1on6H5nzMdoWn9qAD4oeWPu4P+0W24G+cv ZIBzL62bBqM5tWaeAGJ7jB+xTbKQ/tdnqJA+EFVLBFfSKYD8KZiaLavrInm7CmoBYM+N gvRQ== X-Gm-Message-State: AOJu0Yx+4cNYJt9nITrULofa2YnSlKuQyUD9qRFhSpHeu994WoduB18+ Lm9/FM0vb4TtyCbFLC56exdJkFEfNQyZ3IFiNEH6PIjc7hkjRpR+ X-Gm-Gg: ASbGncvwkziGMppowH3tFksXYgFUWoXRwuVULNFHFw0WAuiBR0Lj1Ey4iawGpZHcYYE 796f28XgnCZq30kGN2kNGvnTU/TqLwrKx43yT01MxhZWl3ghVqTACe5h2qvFJ2pq2W5p6wKQ+jN 5YS1NM7MgkeCmkux3sSWG9oBTpzUaxSJMO1ZvjJzMbuKdjQ+ADGyWC1Ubk2jO8sVorN5NPJiBhg ssZYs/Ik9Zvrr203Q0YiwJuNJqwXwXpFGVCNzxI/e1qkLChurq5lL24fTuQzzK8nPIvatSeo04W YDhtTMhKZFB+KD80fkpUPMuw9QvfnO69GJKa8jNANohKfl5pt12AQWQ4zg== X-Google-Smtp-Source: AGHT+IGkT9VQaEB8tT0bM7KfNqEYjKywCODBTj339WeceljuJkeqnlGvrYJ4tuJJnrRHEQmdcocGzw== X-Received: by 2002:a05:600c:35ce:b0:434:a6af:d333 with SMTP id 5b1f17b1804b1-434a9dd00eamr188105645e9.16.1733059839368; Sun, 01 Dec 2024 05:30:39 -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-434aa7e4c89sm147040045e9.41.2024.12.01.05.30.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Dec 2024 05:30:39 -0800 (PST) In-Reply-To: <871pyrmui4.fsf@protonmail.com> (Pip Cet's message of "Sun, 01 Dec 2024 12:57:04 +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:296251 Archived-At: 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 :-(. > > Obviously, we cannot make any such guarantees when MPS is in use. (I > don't think we can make the guarantee when MPS is not in use, but I'm > not totally certain; we certainly allocate strings while parsing JSON, > which is sufficient to trigger GC in the MPS case). If json.c calls something like maybe_quit, which I's expect it must, then GC can indeed happen. See bug#56108 for an example in the regexp code found with ASAN. It's not as risky in the old code as with concurrent GC, but anyway. > > Note that the json_parser object itself is fine (it's allocated on the > stack, thus marked ambiguously), it's only in the case that we create > more than 64 Lisp_Object values when parsing a single JSON document that > we end up with untraced references on the heap. > > I don't know whether it's likely that that was what happened to Oscar. > My gut feeling is 64 objects would be easily reached by LSP messages, > but I'd need more time to test. > > Anyway, here's a patch which might help: > > commit c175744f2172ba3405ae98eb3575b2bf4adadfa4 > Author: Pip Cet > Date: Sun Dec 1 12:46:08 2024 +0000 Very nide, thank you!