unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eval Exec <execvy@gmail.com>
To: Pip Cet <pipcet@protonmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
Date: Fri, 9 Aug 2024 00:56:25 +0800	[thread overview]
Message-ID: <CAKfPJDrDnAzYtg1sYsQxZa7rW4ZFifo2FRP6YVy+0=cRvcdxsg@mail.gmail.com> (raw)
In-Reply-To: <9d5pSofW1FhcAKO7fyf_c8hAwDE8aiuiDGWFglQZI-1FwaDY3KBS5zPkKt0nKUkzs0McRm9kHq47qZjzTz0rgfde5QfLH0v0KdgUxVXI6GA=@protonmail.com>

Hello, I apply the patch into
`42731228d24c37edb2dc848c3a74d5c932a817ef`, Then build emacs by:
```bash
make extraclean
./autogen.sh \
  && ./configure \
  --prefix=$(realpath ../emacs-build/$(git branch --show-current | sed
's/\//_/g'))\
  --with-mps \
  --with-imagemagick \
  --with-modules --with-x-toolkit=lucid --without-compress-install \
  --without-toolkit-scroll-bars --with-native-compilation  --with-mailutils\
  --with-tree-sitter --with-xinput2  \
  --with-dbus  --with-native-compilation=aot \
  --with-file-notification=inotify\
  && make -j20 install
```
Thanks for your work, emacs hasn't crashed anymore.

On Tue, Aug 6, 2024 at 12:41 AM Pip Cet <pipcet@protonmail.com> wrote:
>
> On Monday, August 5th, 2024 at 16:20, Pip Cet <pipcet@protonmail.com> wrote:
> > "Eval Exec" execvy@gmail.com writes:
> >
> > > I wanted to help test the scratch/igc branch, so I compiled it from
> > > commit 42731228d24.
> >
> > Thank you for doing that!
> >
> > > Then I build it by
> > > ```bash
> > > make extraclean
> > > ./autogen.sh \
> > > && ./configure \
> > > --prefix=$(realpath ../emacs-build)\
> > > --with-mps \
> > > --with-imagemagick \
> > > --with-modules --with-x-toolkit=lucid --without-compress-install \
> > > --without-toolkit-scroll-bars --with-native-compilation --with-mailutils\
> > > --with-tree-sitter --with-xinput2 \
> > > --with-dbus --with-native-compilation=aot \
> > > --with-file-notification=inotify\
> > > && make -j20 install
> >
> >
> > Like Eli, I'm suspecting the Lucid widget code...
> >
> > > It works perfectly for the first hour, but then it crashes, and I
> > > don't know how to reproduce the issue.
> > >
> > > I think the crash is caused by "window size adjustments"
> > > ```
> > > (gdb) bt
> > > #0 0x00007f47afea2efc in __pthread_kill_implementation () from
> > > /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
> > > #1 0x00007f47afe52e86 in raise () from
> > > /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
> > > #2 0x00000000004243a4 in terminate_due_to_signal (sig=sig@entry=8,
> > > backtrace_limit=backtrace_limit@entry=40) at emacs.c:470
> > > #3 0x00000000004248fc in handle_fatal_signal (sig=sig@entry=8) at sysdep.c:1800
> > > #4 0x000000000056f568 in deliver_thread_signal (sig=8,
> > > handler=0x4248f1 <handle_fatal_signal>) at sysdep.c:1792
> > > #5 0x000000000056f669 in deliver_fatal_thread_signal (sig=<optimized
> > > out>) at sysdep.c:1812
> > > #6 <signal handler called>
> > > #7 0x000000000069e35e in pixel_to_char_size
> > > (pixel_width=pixel_width@entry=482,
> > > pixel_height=pixel_height@entry=76,
> > > char_width=char_width@entry=0x7ffced20da38,
> > > char_height=char_height@entry=0x7ffced20da3c,
> > > ew=<optimized out>) at widget.c:172
> >
> >
> > That code reads:
> >
> > static void
> > pixel_to_char_size (EmacsFrame ew, Dimension pixel_width,
> > Dimension pixel_height, int *char_width, int *char_height)
> > {
> > struct frame *f = ew->emacs_frame.frame;
> >
> >
> > *char_width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, (int) pixel_width);
> > *char_height = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, (int) pixel_height);
> > }
> >
> > Which gets a frame pointer from a structure (ew) that MPS doesn't know
> > about; but frames can move, so that explains the bug, because MPS
> > doesn't know to update the pointer in the EmacsFrame structure.
> >
> > Unfortunately, the structure is allocated by XtCreateWidget, which calls
> > malloc(), IIUC. So it's not immediately obvious (to me) how to fix it.
> > My best idea so far is to create an ambiguous root covering the frame
> > pointer and store that in the structure instead.
>
> So I've done that, can you try the attached patch? This is a first stab (thus the ambiguous alloc), but it should prevent the crash we've seen.
>
> TODO list for this:
> - use precise alloc
> - check framep, not *framep, in EmacsFrameInitialize
>
> Pip



      parent reply	other threads:[~2024-08-08 16:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-05 15:00 [MPS-test] scratch/igc branch (commit: 42731228d24) crashed Eval Exec
2024-08-05 15:12 ` Gerd Möllmann
2024-08-05 15:18   ` Eval Exec
2024-08-05 15:34     ` Gerd Möllmann
2024-08-05 15:20   ` Eval Exec
2024-08-05 15:45     ` Gerd Möllmann
2024-08-05 15:48       ` Eval Exec
2024-08-05 15:55         ` Eval Exec
2024-08-05 16:14       ` Eval Exec
2024-08-05 15:29 ` Eli Zaretskii
2024-08-05 15:33   ` Eval Exec
2024-08-05 15:47   ` Gerd Möllmann
2024-08-05 15:54     ` Eli Zaretskii
2024-08-05 16:01       ` Gerd Möllmann
2024-08-05 16:20 ` Pip Cet
2024-08-05 16:40   ` Pip Cet
2024-08-05 16:50     ` Eval Exec
2024-08-05 17:45     ` Eli Zaretskii
2024-08-05 18:00       ` Pip Cet
2024-08-05 18:19         ` Eli Zaretskii
2024-08-08 16:56     ` Eval Exec [this message]

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='CAKfPJDrDnAzYtg1sYsQxZa7rW4ZFifo2FRP6YVy+0=cRvcdxsg@mail.gmail.com' \
    --to=execvy@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).