From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Pip Cet <pipcet@protonmail.com>
Cc: Emacs Devel <emacs-devel@gnu.org>,
Helmut Eller <eller.helmut@gmail.com>
Subject: Re: MPS: assertion failed: header_type (h) != IGC_OBJ_FWD
Date: Sun, 14 Jul 2024 09:00:08 +0200 [thread overview]
Message-ID: <m27cdoh30n.fsf@pro2.fritz.box> (raw)
In-Reply-To: <Xjw10r_cMzvbm8BFWpAJVyayR6qiJLZdAvcU8H9W2nflu9td1W4l6YKzju-r0lmnJGxpRUYQhQZ0h8w-Zam-THCG51YyHNCskDQmS5maEBE=@protonmail.com> (Pip Cet's message of "Sun, 14 Jul 2024 05:30:36 +0000")
Pip Cet <pipcet@protonmail.com> writes:
> On Sunday, July 14th, 2024 at 04:12, Gerd Möllmann <gerd.moellmann@gmail.com> wrote:
>> I'm seeing this assertion sometimes in an Emacs built with
>> --enable-checking=igc_debug,igc_check_fwd,w here sometines means it can
>> take days of using/running Emacs, or it can take a couple of hours.
>> This is macOS 14, arm64. I'm linking with -lmps-debug.
>
> That means lldb and no core dumps, right? (I've had to work with lldb
> to make the Android port work with mps, and it's decidedly Not My
> GDB).
Yes, no GDB for macOS/arm64. I mean LLDB is okay for the usual
debugging, but in this case hm. But I don't know if GDB would do better,
either.
(One can produce core dumps, BTW, but it's complicated, requires signing
and entitlements, and is not really helpful debugging-wise, and the
dumps are several GB large.)
What I did is enter a loop with sleep(3) instead of asserting, so that
one can attach to the process. That works, but with optimizations I
can't see much.
>> The assertion means that we likely have a reference somewhere that
>> isn't traced. Because it isn't traced, the reference isn't changed to
>> point to the new location when the object being references is copied
>> to a new address in memory. Instead, it points to kind of a tombstone
>> that is left behind when the object is moved.
>
> My approach would be to try to capture it in a debugger, then follow
> the forwarding pointer and find out what kind of object the pointer
> should be referring to.
Exactly. If it's reproducible, one can also remember the hash, and stop
when objects with that hash are allocated, to see where they are stored.
That worked pretty well in the past, but in this case led to nothing.
> I'm thinking, though, about how to increase pressure to flush out such
> bugs. Here are some ideas:
>
> 1. scan xmalloc'd memory for pointers that refer to MPS-managed objects.
> 2. reduce generation sizes and increase the number of generations, making it more likely objects will be copied.
> 3. trigger GC regularly while allocating objects
> 4. Hack MPS to do something.
> 5. Keep a log of forwarded objects and their old/new pointers
>
(2) and (3) I've tried but no new findings, with (3) as far as it went
witout rendering Emacs unbearable interactively.
Also tried making specpdl and byte stack ambiguous roots, in their
entirety. Slowness but still asserted once, so I guess I can exclude
these two, with some probability.
> (1) seems the most complete approach but relies on unusual pointer
> representations to reduce the number of false positives (and even
> then, they might be pinned objects and then the pointer is okay...).
>
> (2) is easy to do, but impacts performance. (3) is easy to do, but
> impacts performance a lot. I'd prefer avoiding (4), and while (5) is
> doable it's probably unnecessary: you can just read the forwarding
> pointer if it's still there.
>
>> Alas, I haven't been able to debug this. One problem is that I
>> can't reproduce it easily, the other is that is is either not
>> happening or happening much less often when building with -O0, and
>> without -O0 I can't see much here.
>
> I assume it's being accessed from Lisp or in an exception handler?
> Which optimization options are you using?
Just -O.
igc_check_fwd runs in places like XCONS and XSYMBOL etc. so it detects
the problem as soom as possible, on the Lisp side. I'd say most of the
time it's a cons that's the problem, and sometimes a symbol. Maybe it's
a cons containing a symbol, or something like that, where sometimes the
cons isn't copied yet, and the symbol is, or something. Hard to tell.
>> This is just to let people know of the problem. If you find a recipe
>> how to reproduce this, please let me know. Or better yet, debug it :-).
>
> Well, it's possible, but quite unlikely, that it is the
> handlerlist_sentinel thing or the Lisp_Mutex->name thing (both fixed).
> Much more likely it's another issue.
Let's see, I've just transferred you latest commits. Like I mentioned,
it can take days for the thing to surface.
next prev parent reply other threads:[~2024-07-14 7:00 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-14 4:12 MPS: assertion failed: header_type (h) != IGC_OBJ_FWD Gerd Möllmann
2024-07-14 5:30 ` Pip Cet
2024-07-14 7:00 ` Gerd Möllmann [this message]
2024-07-14 7:08 ` Gerd Möllmann
2024-07-16 13:02 ` Gerd Möllmann
2024-07-16 13:38 ` Eli Zaretskii
2024-07-16 13:47 ` Gerd Möllmann
2024-07-16 14:11 ` Eli Zaretskii
2024-07-16 14:39 ` Gerd Möllmann
2024-07-16 15:21 ` Eli Zaretskii
2024-07-16 16:54 ` Gerd Möllmann
2024-07-16 14:19 ` Helmut Eller
2024-07-16 14:48 ` Gerd Möllmann
2024-07-16 15:22 ` Eli Zaretskii
2024-07-16 16:13 ` Pip Cet
2024-07-16 16:47 ` Gerd Möllmann
2024-07-17 7:51 ` Andrea Corallo
2024-07-17 19:47 ` Gerd Möllmann
2024-07-18 15:08 ` Gerd Möllmann
2024-07-18 16:05 ` Pip Cet
2024-07-18 16:33 ` Gerd Möllmann
2024-07-18 19:06 ` Andrea Corallo
2024-07-18 19:33 ` Gerd Möllmann
2024-07-19 4:38 ` Gerd Möllmann
2024-07-23 0:36 ` Pip Cet
2024-07-23 3:31 ` Gerd Möllmann
2024-07-16 15:49 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m27cdoh30n.fsf@pro2.fritz.box \
--to=gerd.moellmann@gmail.com \
--cc=eller.helmut@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=pipcet@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).