unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
@ 2024-08-05 15:00 Eval Exec
  2024-08-05 15:12 ` Gerd Möllmann
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Eval Exec @ 2024-08-05 15:00 UTC (permalink / raw)
  To: emacs-devel

Hello,

I wanted to help test the scratch/igc branch, so I compiled it from
commit 42731228d24.

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

```

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
#8  0x000000000069e45a in update_wm_hints
(wmshell=wmshell@entry=0x395c110, ew=<optimized out>) at widget.c:290
#9  0x000000000069ead5 in widget_update_wm_size_hints
(widget=widget@entry=0x395c110, frame=<optimized out>) at widget.c:323
#10 0x000000000051e8ae in x_wm_set_size_hint
(f=f@entry=0x7f4734de0268, flags=flags@entry=0,
user_position=user_position@entry=false) at xterm.c:30123
#11 0x000000000051ee7f in x_set_window_size_1 (height=113, width=1058,
change_gravity=<optimized out>, f=0x7f4734de0268) at xterm.c:28525
#12 x_set_window_size (f=0x7f4734de0268, change_gravity=<optimized
out>, width=1058, height=113) at xterm.c:28603
#13 0x000000000043bf21 in adjust_frame_size (f=f@entry=0x7f4734de0268,
new_text_width=<optimized out>, new_text_width@entry=1056,
new_text_height=new_text_height@entry=111, inhibit=inhibit@entry=1,
    pretend=pretend@entry=false, parameter=<optimized out>) at frame.c:784
#14 0x000000000043f705 in gui_set_frame_parameters_1
(f=0x7f4734de0268, alist=<optimized out>,
default_parameter=default_parameter@entry=false) at frame.c:4469
#15 0x00000000004403a7 in gui_set_frame_parameters (f=<optimized out>,
alist=<optimized out>) at frame.c:4561
#16 0x00000000004405eb in Fmodify_frame_parameters (frame=<optimized
out>, alist=0x7f472e53e3b3) at frame.c:3550
#17 0x00000000005de5fb in eval_sub (form=<optimized out>) at eval.c:2622
#18 0x00000000005de721 in Fprogn (body=<optimized out>) at eval.c:452
#19 0x00000000005dfd83 in FletX (args=<optimized out>) at
/home/exec/Projects/git.savannah.gnu.org/git/emacs/src/lisp.h:1586
#20 0x00000000005de498 in eval_sub (form=<optimized out>) at eval.c:2570
#21 0x00000000005de721 in Fprogn (body=<optimized out>) at eval.c:452
#22 0x00000000005de98f in funcall_lambda (fun=0x7f4725406215, nargs=1,
arg_vector=<optimized out>) at eval.c:3371
#23 0x00000000005daee4 in Ffuncall (nargs=2, args=0x7ffced20e230) at eval.c:3114
#24 0x00007f4799b1cbfd in
F6c73702d75692d646f632d2d646973706c6179_lsp_ui_doc__display_0 () from
/home/exec/.emacs.d/eln-cache/31.0.50-2fd6718c/lsp-ui-doc-c3d98a1c-dcddc9b5.eln
#25 0x00000000005daee4 in Ffuncall (nargs=3, args=0x7ffced20e380) at eval.c:3114
#26 0x00007f4799b1da79 in
F6c73702d75692d646f632d2d63616c6c6261636b_lsp_ui_doc__callback_0 ()
from /home/exec/.emacs.d/eln-cache/31.0.50-2fd6718c/lsp-ui-doc-c3d98a1c-dcddc9b5.eln
#27 0x000000000062735a in exec_byte_code (fun=<optimized out>,
args_template=<optimized out>, nargs=<optimized out>, args=<optimized
out>) at /home/exec/Projects/git.savannah.gnu.org/git/emacs/src/lisp.h:2322
#28 0x00000000005daee4 in Ffuncall (nargs=nargs@entry=2,
args=args@entry=0x7f479a9ff1c0) at eval.c:3114
#29 0x00000000005db447 in Fapply (nargs=2, args=0x7f479a9ff1c0) at eval.c:2743
#30 0x000000000062735a in exec_byte_code (fun=<optimized out>,
args_template=<optimized out>, nargs=<optimized out>, args=<optimized
out>) at /home/exec/Projects/git.savannah.gnu.org/git/emacs/src/lisp.h:2322
#31 0x00000000005daee4 in Ffuncall (nargs=2, args=0x7ffced20e6e0) at eval.c:3114
#32 0x00007f475db9485a in
F6c73702d2d7061727365722d6f6e2d6d657373616765_lsp__parser_on_message_0
() from /home/exec/.emacs.d/eln-cache/31.0.50-2fd6718c/lsp-mode-985690c1-6ee62a7e.eln
#33 0x000000000062735a in exec_byte_code (fun=<optimized out>,
args_template=<optimized out>, nargs=<optimized out>, args=<optimized
out>) at /home/exec/Projects/git.savannah.gnu.org/git/emacs/src/lisp.h:2322
#34 0x00000000005daee4 in Ffuncall (nargs=nargs@entry=2,
args=args@entry=0x7ffced20e850) at eval.c:3114
#35 0x00000000005e6f77 in mapcar1 (leni=1, vals=vals@entry=0x0,
fn=fn@entry=0x7f472e3ff99d, seq=seq@entry=0x7f472e3ff963) at
fns.c:3369
#36 0x00000000005e9f30 in Fmapc (function=0x7f472e3ff99d,
sequence=0x7f472e3ff963) at fns.c:3506
#37 0x000000000062735a in exec_byte_code (fun=<optimized out>,
args_template=<optimized out>, nargs=<optimized out>, args=<optimized
out>) at /home/exec/Projects/git.savannah.gnu.org/git/emacs/src/lisp.h:2322
#38 0x00000000005daee4 in Ffuncall (nargs=nargs@entry=3,
args=0x7ffced20e9b0) at eval.c:3114
#39 0x00000000005db238 in Fapply (nargs=nargs@entry=2,
args=args@entry=0x7ffced20ea60) at eval.c:2786
#40 0x00000000005db551 in apply1 (fn=<optimized out>, arg=<optimized
out>) at eval.c:3002
#41 0x00000000005d981c in internal_condition_case_1
(bfun=bfun@entry=0x6345b0 <read_process_output_call>,
arg=0x7f472e3fba73, handlers=handlers@entry=0xa8,
    hfun=hfun@entry=0x6344f0 <read_process_output_error_handler>) at eval.c:1657
#42 0x00000000006374e0 in read_and_dispose_of_process_output
(coding=0x36666e0, nbytes=371,
    chars=0x7f4704fff010 "Content-Length: 348\r\n\r\n#[0
\"\\303\\304\\305\\306\\307\\310\\311\\312\\313\\314F\\315\\316\\301\\300\\302\\300F\\317\\301\\320\\302\\300FFF\\257\\6\\207\"
[33 :character :line :id 984 :jsonrpc \"2.0\" :result :contents :kind
\"ma"..., p=<optimized out>) at process.c:6499
#43 read_process_output (proc=proc@entry=0x7f4727170175,
channel=channel@entry=38) at process.c:6267
#44 0x000000000063efd1 in wait_reading_process_output
(time_limit=time_limit@entry=30, nsecs=nsecs@entry=0,
read_kbd=read_kbd@entry=-1, do_display=do_display@entry=true,
wait_for_cell=wait_for_cell@entry=0x0,
    wait_proc=wait_proc@entry=0x0, just_wait_proc=0) at process.c:5948
#45 0x000000000043827a in sit_for (timeout=timeout@entry=0x7a,
reading=reading@entry=true, display_option=display_option@entry=1) at
dispnew.c:6362
#46 0x0000000000560fc2 in read_char (commandflag=1,
map=map@entry=0x7f472e319bc3, prev_event=0x0,
used_mouse_menu=used_mouse_menu@entry=0x7ffced20f47b,
end_time=end_time@entry=0x0) at keyboard.c:2934
#47 0x0000000000561a73 in read_key_sequence
(keybuf=keybuf@entry=0x7ffced20f600, prompt=prompt@entry=0x0,
dont_downcase_last=dont_downcase_last@entry=false,
    can_return_switch_frame=can_return_switch_frame@entry=true,
fix_current_buffer=fix_current_buffer@entry=true,
prevent_redisplay=prevent_redisplay@entry=false,
disable_text_conversion_p=false) at keyboard.c:10752
#48 0x0000000000563ba8 in command_loop_1 () at keyboard.c:1440
#49 0x00000000005d978f in internal_condition_case
(bfun=bfun@entry=0x5639d0 <command_loop_1>,
handlers=handlers@entry=0xa8, hfun=hfun@entry=0x553a30 <cmd_error>) at
eval.c:1633
#50 0x000000000054ea06 in command_loop_2
(handlers=handlers@entry=0xa8) at keyboard.c:1179
--Type <RET> for more, q to quit, c to continue without paging--c
#51 0x00000000005d96b3 in internal_catch (tag=tag@entry=0x15498,
func=func@entry=0x54e9e0 <command_loop_2>, arg=arg@entry=0xa8) at
eval.c:1312
#52 0x000000000054e9a1 in command_loop () at keyboard.c:1157
#53 0x000000000055359a in recursive_edit_1 () at keyboard.c:765
#54 0x000000000055391f in Frecursive_edit () at keyboard.c:848
#55 0x000000000042d27f in main (argc=1, argv=0x7ffced20faa8) at emacs.c:2646
```



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  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:20   ` Eval Exec
  2024-08-05 15:29 ` Eli Zaretskii
  2024-08-05 16:20 ` Pip Cet
  2 siblings, 2 replies; 21+ messages in thread
From: Gerd Möllmann @ 2024-08-05 15:12 UTC (permalink / raw)
  To: Eval Exec; +Cc: emacs-devel

Eval Exec <execvy@gmail.com> writes:

> Hello,
>
> I wanted to help test the scratch/igc branch, so I compiled it from
> commit 42731228d24.
>
> 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
>
> ```
>
> 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,

Assuming this is an MPS build (please check with (featurep 'mps)).

I can't see anything obvious from the backtrace. Can you try to look at
pixel_to_char_size in GDB? Or describe how to reproduce this? I'm myself
on macOS, so cannot really help much in this case, I guess.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  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
  1 sibling, 1 reply; 21+ messages in thread
From: Eval Exec @ 2024-08-05 15:18 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: emacs-devel

I enter `coredumpctl gdb`,
got this:
```(gdb) p pixel_to_char_size
$1 = {void (Dimension, Dimension, int *, int *, EmacsFrame)} 0x69e310
<pixel_to_char_size>
```

On Mon, Aug 5, 2024 at 11:12 PM Gerd Möllmann <gerd.moellmann@gmail.com> wrote:
>
> Eval Exec <execvy@gmail.com> writes:
>
> > Hello,
> >
> > I wanted to help test the scratch/igc branch, so I compiled it from
> > commit 42731228d24.
> >
> > 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
> >
> > ```
> >
> > 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,
>
> Assuming this is an MPS build (please check with (featurep 'mps)).
>
> I can't see anything obvious from the backtrace. Can you try to look at
> pixel_to_char_size in GDB? Or describe how to reproduce this? I'm myself
> on macOS, so cannot really help much in this case, I guess.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  2024-08-05 15:12 ` Gerd Möllmann
  2024-08-05 15:18   ` Eval Exec
@ 2024-08-05 15:20   ` Eval Exec
  2024-08-05 15:45     ` Gerd Möllmann
  1 sibling, 1 reply; 21+ messages in thread
From: Eval Exec @ 2024-08-05 15:20 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: emacs-devel

> Or describe how to reproduce this

I'm not sure how to reproduce this, but it seems to happen sometimes
when I open a Rust file in lsp-mode. When I start typing, the Corfu
completion popup appears with candidate suggestions. Occasionally, the
Corfu popup will freeze, causing Emacs to freeze as well, and then
Emacs crashes after about a second.

On Mon, Aug 5, 2024 at 11:12 PM Gerd Möllmann <gerd.moellmann@gmail.com> wrote:
>
> Eval Exec <execvy@gmail.com> writes:
>
> > Hello,
> >
> > I wanted to help test the scratch/igc branch, so I compiled it from
> > commit 42731228d24.
> >
> > 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
> >
> > ```
> >
> > 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,
>
> Assuming this is an MPS build (please check with (featurep 'mps)).
>
> I can't see anything obvious from the backtrace. Can you try to look at
> pixel_to_char_size in GDB? Or describe how to reproduce this? I'm myself
> on macOS, so cannot really help much in this case, I guess.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  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:29 ` Eli Zaretskii
  2024-08-05 15:33   ` Eval Exec
  2024-08-05 15:47   ` Gerd Möllmann
  2024-08-05 16:20 ` Pip Cet
  2 siblings, 2 replies; 21+ messages in thread
From: Eli Zaretskii @ 2024-08-05 15:29 UTC (permalink / raw)
  To: Eval Exec; +Cc: emacs-devel

> From: Eval Exec <execvy@gmail.com>
> Date: Mon, 5 Aug 2024 23:00:16 +0800
> 
> I think the crash is caused by "window size adjustments"

No, it is somehow caused by lsp-mode reading from the LSP server:

> (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
> #8  0x000000000069e45a in update_wm_hints
> (wmshell=wmshell@entry=0x395c110, ew=<optimized out>) at widget.c:290
> #9  0x000000000069ead5 in widget_update_wm_size_hints
> (widget=widget@entry=0x395c110, frame=<optimized out>) at widget.c:323
> #10 0x000000000051e8ae in x_wm_set_size_hint
> (f=f@entry=0x7f4734de0268, flags=flags@entry=0,
> user_position=user_position@entry=false) at xterm.c:30123
> #11 0x000000000051ee7f in x_set_window_size_1 (height=113, width=1058,
> change_gravity=<optimized out>, f=0x7f4734de0268) at xterm.c:28525
> #12 x_set_window_size (f=0x7f4734de0268, change_gravity=<optimized
> out>, width=1058, height=113) at xterm.c:28603
> #13 0x000000000043bf21 in adjust_frame_size (f=f@entry=0x7f4734de0268,
> new_text_width=<optimized out>, new_text_width@entry=1056,
> new_text_height=new_text_height@entry=111, inhibit=inhibit@entry=1,
>     pretend=pretend@entry=false, parameter=<optimized out>) at frame.c:784
> #14 0x000000000043f705 in gui_set_frame_parameters_1
> (f=0x7f4734de0268, alist=<optimized out>,
> default_parameter=default_parameter@entry=false) at frame.c:4469
> #15 0x00000000004403a7 in gui_set_frame_parameters (f=<optimized out>,
> alist=<optimized out>) at frame.c:4561
> #16 0x00000000004405eb in Fmodify_frame_parameters (frame=<optimized
> out>, alist=0x7f472e53e3b3) at frame.c:3550
> #17 0x00000000005de5fb in eval_sub (form=<optimized out>) at eval.c:2622
> #18 0x00000000005de721 in Fprogn (body=<optimized out>) at eval.c:452
> #19 0x00000000005dfd83 in FletX (args=<optimized out>) at
> /home/exec/Projects/git.savannah.gnu.org/git/emacs/src/lisp.h:1586
> #20 0x00000000005de498 in eval_sub (form=<optimized out>) at eval.c:2570
> #21 0x00000000005de721 in Fprogn (body=<optimized out>) at eval.c:452
> #22 0x00000000005de98f in funcall_lambda (fun=0x7f4725406215, nargs=1,
> arg_vector=<optimized out>) at eval.c:3371
> #23 0x00000000005daee4 in Ffuncall (nargs=2, args=0x7ffced20e230) at eval.c:3114
> #24 0x00007f4799b1cbfd in
> F6c73702d75692d646f632d2d646973706c6179_lsp_ui_doc__display_0 () from
> /home/exec/.emacs.d/eln-cache/31.0.50-2fd6718c/lsp-ui-doc-c3d98a1c-dcddc9b5.eln
> #25 0x00000000005daee4 in Ffuncall (nargs=3, args=0x7ffced20e380) at eval.c:3114
> #26 0x00007f4799b1da79 in
> F6c73702d75692d646f632d2d63616c6c6261636b_lsp_ui_doc__callback_0 ()
> from /home/exec/.emacs.d/eln-cache/31.0.50-2fd6718c/lsp-ui-doc-c3d98a1c-dcddc9b5.eln
> #27 0x000000000062735a in exec_byte_code (fun=<optimized out>,
> args_template=<optimized out>, nargs=<optimized out>, args=<optimized
> out>) at /home/exec/Projects/git.savannah.gnu.org/git/emacs/src/lisp.h:2322
> #28 0x00000000005daee4 in Ffuncall (nargs=nargs@entry=2,
> args=args@entry=0x7f479a9ff1c0) at eval.c:3114
> #29 0x00000000005db447 in Fapply (nargs=2, args=0x7f479a9ff1c0) at eval.c:2743
> #30 0x000000000062735a in exec_byte_code (fun=<optimized out>,
> args_template=<optimized out>, nargs=<optimized out>, args=<optimized
> out>) at /home/exec/Projects/git.savannah.gnu.org/git/emacs/src/lisp.h:2322
> #31 0x00000000005daee4 in Ffuncall (nargs=2, args=0x7ffced20e6e0) at eval.c:3114
> #32 0x00007f475db9485a in
> F6c73702d2d7061727365722d6f6e2d6d657373616765_lsp__parser_on_message_0
> () from /home/exec/.emacs.d/eln-cache/31.0.50-2fd6718c/lsp-mode-985690c1-6ee62a7e.eln
                                                         ^^^^^^^^

I guess no one has yet built the branch with Lucid toolkit?  Maybe the
scroll bars etc. in that build are not handled correctly?



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  2024-08-05 15:29 ` Eli Zaretskii
@ 2024-08-05 15:33   ` Eval Exec
  2024-08-05 15:47   ` Gerd Möllmann
  1 sibling, 0 replies; 21+ messages in thread
From: Eval Exec @ 2024-08-05 15:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

I'm trying to build it with `--with-x-toolkit=gtk3` instead of `lucid`
now. Let me see if I can reproduce it.

On Mon, Aug 5, 2024 at 11:30 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Eval Exec <execvy@gmail.com>
> > Date: Mon, 5 Aug 2024 23:00:16 +0800
> >
> > I think the crash is caused by "window size adjustments"
>
> No, it is somehow caused by lsp-mode reading from the LSP server:
>
> > (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
> > #8  0x000000000069e45a in update_wm_hints
> > (wmshell=wmshell@entry=0x395c110, ew=<optimized out>) at widget.c:290
> > #9  0x000000000069ead5 in widget_update_wm_size_hints
> > (widget=widget@entry=0x395c110, frame=<optimized out>) at widget.c:323
> > #10 0x000000000051e8ae in x_wm_set_size_hint
> > (f=f@entry=0x7f4734de0268, flags=flags@entry=0,
> > user_position=user_position@entry=false) at xterm.c:30123
> > #11 0x000000000051ee7f in x_set_window_size_1 (height=113, width=1058,
> > change_gravity=<optimized out>, f=0x7f4734de0268) at xterm.c:28525
> > #12 x_set_window_size (f=0x7f4734de0268, change_gravity=<optimized
> > out>, width=1058, height=113) at xterm.c:28603
> > #13 0x000000000043bf21 in adjust_frame_size (f=f@entry=0x7f4734de0268,
> > new_text_width=<optimized out>, new_text_width@entry=1056,
> > new_text_height=new_text_height@entry=111, inhibit=inhibit@entry=1,
> >     pretend=pretend@entry=false, parameter=<optimized out>) at frame.c:784
> > #14 0x000000000043f705 in gui_set_frame_parameters_1
> > (f=0x7f4734de0268, alist=<optimized out>,
> > default_parameter=default_parameter@entry=false) at frame.c:4469
> > #15 0x00000000004403a7 in gui_set_frame_parameters (f=<optimized out>,
> > alist=<optimized out>) at frame.c:4561
> > #16 0x00000000004405eb in Fmodify_frame_parameters (frame=<optimized
> > out>, alist=0x7f472e53e3b3) at frame.c:3550
> > #17 0x00000000005de5fb in eval_sub (form=<optimized out>) at eval.c:2622
> > #18 0x00000000005de721 in Fprogn (body=<optimized out>) at eval.c:452
> > #19 0x00000000005dfd83 in FletX (args=<optimized out>) at
> > /home/exec/Projects/git.savannah.gnu.org/git/emacs/src/lisp.h:1586
> > #20 0x00000000005de498 in eval_sub (form=<optimized out>) at eval.c:2570
> > #21 0x00000000005de721 in Fprogn (body=<optimized out>) at eval.c:452
> > #22 0x00000000005de98f in funcall_lambda (fun=0x7f4725406215, nargs=1,
> > arg_vector=<optimized out>) at eval.c:3371
> > #23 0x00000000005daee4 in Ffuncall (nargs=2, args=0x7ffced20e230) at eval.c:3114
> > #24 0x00007f4799b1cbfd in
> > F6c73702d75692d646f632d2d646973706c6179_lsp_ui_doc__display_0 () from
> > /home/exec/.emacs.d/eln-cache/31.0.50-2fd6718c/lsp-ui-doc-c3d98a1c-dcddc9b5.eln
> > #25 0x00000000005daee4 in Ffuncall (nargs=3, args=0x7ffced20e380) at eval.c:3114
> > #26 0x00007f4799b1da79 in
> > F6c73702d75692d646f632d2d63616c6c6261636b_lsp_ui_doc__callback_0 ()
> > from /home/exec/.emacs.d/eln-cache/31.0.50-2fd6718c/lsp-ui-doc-c3d98a1c-dcddc9b5.eln
> > #27 0x000000000062735a in exec_byte_code (fun=<optimized out>,
> > args_template=<optimized out>, nargs=<optimized out>, args=<optimized
> > out>) at /home/exec/Projects/git.savannah.gnu.org/git/emacs/src/lisp.h:2322
> > #28 0x00000000005daee4 in Ffuncall (nargs=nargs@entry=2,
> > args=args@entry=0x7f479a9ff1c0) at eval.c:3114
> > #29 0x00000000005db447 in Fapply (nargs=2, args=0x7f479a9ff1c0) at eval.c:2743
> > #30 0x000000000062735a in exec_byte_code (fun=<optimized out>,
> > args_template=<optimized out>, nargs=<optimized out>, args=<optimized
> > out>) at /home/exec/Projects/git.savannah.gnu.org/git/emacs/src/lisp.h:2322
> > #31 0x00000000005daee4 in Ffuncall (nargs=2, args=0x7ffced20e6e0) at eval.c:3114
> > #32 0x00007f475db9485a in
> > F6c73702d2d7061727365722d6f6e2d6d657373616765_lsp__parser_on_message_0
> > () from /home/exec/.emacs.d/eln-cache/31.0.50-2fd6718c/lsp-mode-985690c1-6ee62a7e.eln
>                                                          ^^^^^^^^
>
> I guess no one has yet built the branch with Lucid toolkit?  Maybe the
> scroll bars etc. in that build are not handled correctly?



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  2024-08-05 15:18   ` Eval Exec
@ 2024-08-05 15:34     ` Gerd Möllmann
  0 siblings, 0 replies; 21+ messages in thread
From: Gerd Möllmann @ 2024-08-05 15:34 UTC (permalink / raw)
  To: Eval Exec; +Cc: emacs-devel

Eval Exec <execvy@gmail.com> writes:

> I enter `coredumpctl gdb`,
> got this:
> ```(gdb) p pixel_to_char_size
> $1 = {void (Dimension, Dimension, int *, int *, EmacsFrame)} 0x69e310
> <pixel_to_char_size>

Thanks, but what I meant was using GDB with the core file or run Emacs
under GDB, look at local variables to see what the problem is, etc.

This of course requires building Emacs with debug info and so on.
etc/DEBUG has hints how to do that.

Or try to make it reproducible, that would maybe help the most.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  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 16:14       ` Eval Exec
  0 siblings, 2 replies; 21+ messages in thread
From: Gerd Möllmann @ 2024-08-05 15:45 UTC (permalink / raw)
  To: Eval Exec; +Cc: emacs-devel

Eval Exec <execvy@gmail.com> writes:

>> Or describe how to reproduce this
>
> I'm not sure how to reproduce this, but it seems to happen sometimes
> when I open a Rust file in lsp-mode. When I start typing, the Corfu
> completion popup appears with candidate suggestions. Occasionally, the
> Corfu popup will freeze, causing Emacs to freeze as well, and then
> Emacs crashes after about a second.

Hm. Can't do much here, I'm afraid.

The location of the error in pixel_something is unusual for a GC-related
error, haven't seen something like that before. Are you using master
without MPS otherwise, and can compare the two?



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  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
  1 sibling, 1 reply; 21+ messages in thread
From: Gerd Möllmann @ 2024-08-05 15:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Eval Exec, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> I guess no one has yet built the branch with Lucid toolkit?  Maybe the
> scroll bars etc. in that build are not handled correctly?

Could also be, yes.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  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
  1 sibling, 1 reply; 21+ messages in thread
From: Eval Exec @ 2024-08-05 15:48 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: emacs-devel

>  Are you using master without MPS otherwise, and can compare the two?
I will try to using master without MPS later.

Now I compiled scratch/igc with --with-x-toolkit=gtk3, and emacs won't
crash anymore.
When I compile scratch/igc with --with-x-toolkit=lucid, and with
(scroll-bar-mode t), emacs won't crash.
When I compile scratch/igc with --with-x-toolkit=lucid, and with
(scroll-bar-mode -1), emacs will crash.

On Mon, Aug 5, 2024 at 11:45 PM Gerd Möllmann <gerd.moellmann@gmail.com> wrote:
>
> Eval Exec <execvy@gmail.com> writes:
>
> >> Or describe how to reproduce this
> >
> > I'm not sure how to reproduce this, but it seems to happen sometimes
> > when I open a Rust file in lsp-mode. When I start typing, the Corfu
> > completion popup appears with candidate suggestions. Occasionally, the
> > Corfu popup will freeze, causing Emacs to freeze as well, and then
> > Emacs crashes after about a second.
>
> Hm. Can't do much here, I'm afraid.
>
> The location of the error in pixel_something is unusual for a GC-related
> error, haven't seen something like that before. Are you using master
> without MPS otherwise, and can compare the two?



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  2024-08-05 15:47   ` Gerd Möllmann
@ 2024-08-05 15:54     ` Eli Zaretskii
  2024-08-05 16:01       ` Gerd Möllmann
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2024-08-05 15:54 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: execvy, emacs-devel

> From: Gerd Möllmann <gerd.moellmann@gmail.com>
> Cc: Eval Exec <execvy@gmail.com>,  emacs-devel@gnu.org
> Date: Mon, 05 Aug 2024 17:47:10 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I guess no one has yet built the branch with Lucid toolkit?  Maybe the
> > scroll bars etc. in that build are not handled correctly?
> 
> Could also be, yes.

Look here (xterm.c):

#ifndef USE_MOTIF
      hints_changed
	= widget_update_wm_size_hints (f->output_data.x->widget,
				       f->output_data.x->edit_widget);
#else

We call widget_update_wm_size_hints with f->output_data.x->widget, but
output_data.c->widget hides a pointer to 'struct frame':

bool
widget_update_wm_size_hints (Widget widget, Widget frame)
{
  return update_wm_hints ((WMShellWidget) widget, (EmacsFrame) frame);
}

and update_wm_hints does:

  pixel_to_char_size (ew, ew->core.width, ew->core.height,
		      &char_width, &char_height);

which does

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;

So if the frame object is moved and
f->output_data.x->widget->emacs_frame.frame is not updated, we are
toast, right?



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  2024-08-05 15:48       ` Eval Exec
@ 2024-08-05 15:55         ` Eval Exec
  0 siblings, 0 replies; 21+ messages in thread
From: Eval Exec @ 2024-08-05 15:55 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: emacs-devel

I'm compiling master branch with --with-x-toolkit=lucid and gtk3 ,
test it if crash in `scroll-bar-mode t and -1)`. Compiling it.

On Mon, Aug 5, 2024 at 11:48 PM Eval Exec <execvy@gmail.com> wrote:
>
> >  Are you using master without MPS otherwise, and can compare the two?
> I will try to using master without MPS later.
>
> Now I compiled scratch/igc with --with-x-toolkit=gtk3, and emacs won't
> crash anymore.
> When I compile scratch/igc with --with-x-toolkit=lucid, and with
> (scroll-bar-mode t), emacs won't crash.
> When I compile scratch/igc with --with-x-toolkit=lucid, and with
> (scroll-bar-mode -1), emacs will crash.
>
> On Mon, Aug 5, 2024 at 11:45 PM Gerd Möllmann <gerd.moellmann@gmail.com> wrote:
> >
> > Eval Exec <execvy@gmail.com> writes:
> >
> > >> Or describe how to reproduce this
> > >
> > > I'm not sure how to reproduce this, but it seems to happen sometimes
> > > when I open a Rust file in lsp-mode. When I start typing, the Corfu
> > > completion popup appears with candidate suggestions. Occasionally, the
> > > Corfu popup will freeze, causing Emacs to freeze as well, and then
> > > Emacs crashes after about a second.
> >
> > Hm. Can't do much here, I'm afraid.
> >
> > The location of the error in pixel_something is unusual for a GC-related
> > error, haven't seen something like that before. Are you using master
> > without MPS otherwise, and can compare the two?



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  2024-08-05 15:54     ` Eli Zaretskii
@ 2024-08-05 16:01       ` Gerd Möllmann
  0 siblings, 0 replies; 21+ messages in thread
From: Gerd Möllmann @ 2024-08-05 16:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: execvy, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann@gmail.com>
>> Cc: Eval Exec <execvy@gmail.com>,  emacs-devel@gnu.org
>> Date: Mon, 05 Aug 2024 17:47:10 +0200
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> > I guess no one has yet built the branch with Lucid toolkit?  Maybe the
>> > scroll bars etc. in that build are not handled correctly?
>> 
>> Could also be, yes.
>
> Look here (xterm.c):
>
> #ifndef USE_MOTIF
>       hints_changed
> 	= widget_update_wm_size_hints (f->output_data.x->widget,
> 				       f->output_data.x->edit_widget);
> #else
>
> We call widget_update_wm_size_hints with f->output_data.x->widget, but
> output_data.c->widget hides a pointer to 'struct frame':
>
> bool
> widget_update_wm_size_hints (Widget widget, Widget frame)
> {
>   return update_wm_hints ((WMShellWidget) widget, (EmacsFrame) frame);
> }
>
> and update_wm_hints does:
>
>   pixel_to_char_size (ew, ew->core.width, ew->core.height,
> 		      &char_width, &char_height);
>
> which does
>
> 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;
>
> So if the frame object is moved and
> f->output_data.x->widget->emacs_frame.frame is not updated, we are
> toast, right?

Yep.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  2024-08-05 15:45     ` Gerd Möllmann
  2024-08-05 15:48       ` Eval Exec
@ 2024-08-05 16:14       ` Eval Exec
  1 sibling, 0 replies; 21+ messages in thread
From: Eval Exec @ 2024-08-05 16:14 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: emacs-devel

I tried master `3ad4623bec49428fda34a475641eae9f1f33fc78`, with
`--with-x-toolkit=lucid`, when scroll-bar-mode is `t` or `-1`, emacs
won't crash.

On Mon, Aug 5, 2024 at 11:45 PM Gerd Möllmann <gerd.moellmann@gmail.com> wrote:
>
> Eval Exec <execvy@gmail.com> writes:
>
> >> Or describe how to reproduce this
> >
> > I'm not sure how to reproduce this, but it seems to happen sometimes
> > when I open a Rust file in lsp-mode. When I start typing, the Corfu
> > completion popup appears with candidate suggestions. Occasionally, the
> > Corfu popup will freeze, causing Emacs to freeze as well, and then
> > Emacs crashes after about a second.
>
> Hm. Can't do much here, I'm afraid.
>
> The location of the error in pixel_something is unusual for a GC-related
> error, haven't seen something like that before. Are you using master
> without MPS otherwise, and can compare the two?



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  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:29 ` Eli Zaretskii
@ 2024-08-05 16:20 ` Pip Cet
  2024-08-05 16:40   ` Pip Cet
  2 siblings, 1 reply; 21+ messages in thread
From: Pip Cet @ 2024-08-05 16:20 UTC (permalink / raw)
  To: Eval Exec; +Cc: emacs-devel

"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.

Pip




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  2024-08-05 16:20 ` Pip Cet
@ 2024-08-05 16:40   ` Pip Cet
  2024-08-05 16:50     ` Eval Exec
                       ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Pip Cet @ 2024-08-05 16:40 UTC (permalink / raw)
  To: Pip Cet; +Cc: Eval Exec, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 3156 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-mps-lucid.patch --]
[-- Type: text/x-patch; name=0001-mps-lucid.patch, Size: 6710 bytes --]

diff --git a/src/widget.c b/src/widget.c
index d22732ff93a..cc1aeeb25a9 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -32,6 +32,7 @@
 #include "sysstdio.h"
 #include "xterm.h"
 #include "frame.h"
+#include "igc.h"
 
 #include <X11/StringDefs.h>
 #include <X11/IntrinsicP.h>
@@ -61,7 +62,7 @@ #define offset(field) offsetof (EmacsFrameRec, emacs_frame.field)
 
   {(char *) XtNemacsFrame, (char *) XtCEmacsFrame,
      XtRPointer, sizeof (XtPointer),
-     offset (frame), XtRImmediate, 0},
+     offset (framep), XtRImmediate, 0},
 
   {(char *) XtNminibuffer, (char *) XtCMinibuffer, XtRInt, sizeof (int),
      offset (minibuffer), XtRImmediate, (XtPointer)0},
@@ -157,7 +158,7 @@ emacsFrameClass (void)
 static void
 get_default_char_pixel_size (EmacsFrame ew, int *pixel_width, int *pixel_height)
 {
-  struct frame *f = ew->emacs_frame.frame;
+  struct frame *f = *ew->emacs_frame.framep;
 
   *pixel_width = FRAME_COLUMN_WIDTH (f);
   *pixel_height = FRAME_LINE_HEIGHT (f);
@@ -167,7 +168,7 @@ get_default_char_pixel_size (EmacsFrame ew, int *pixel_width, int *pixel_height)
 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;
+  struct frame *f = *ew->emacs_frame.framep;
 
   *char_width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, (int) pixel_width);
   *char_height = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, (int) pixel_height);
@@ -177,7 +178,7 @@ pixel_to_char_size (EmacsFrame ew, Dimension pixel_width,
 char_to_pixel_size (EmacsFrame ew, int char_width, int char_height,
 		    Dimension *pixel_width, Dimension *pixel_height)
 {
-  struct frame *f = ew->emacs_frame.frame;
+  struct frame *f = *ew->emacs_frame.framep;
 
   *pixel_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, char_width);
   *pixel_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, char_height);
@@ -259,7 +260,7 @@ set_frame_size (EmacsFrame ew)
 
    */
 
-  struct frame *f = ew->emacs_frame.frame;
+  struct frame *f = *ew->emacs_frame.framep;
 
   ew->core.width = FRAME_PIXEL_WIDTH (f);
   ew->core.height = FRAME_PIXEL_HEIGHT (f);
@@ -326,7 +327,7 @@ widget_update_wm_size_hints (Widget widget, Widget frame)
 static void
 update_various_frame_slots (EmacsFrame ew)
 {
-  struct frame *f = ew->emacs_frame.frame;
+  struct frame *f = *ew->emacs_frame.framep;
 
   f->internal_border_width = ew->emacs_frame.internal_border_width;
 }
@@ -334,7 +335,7 @@ update_various_frame_slots (EmacsFrame ew)
 static void
 update_from_various_frame_slots (EmacsFrame ew)
 {
-  struct frame *f = ew->emacs_frame.frame;
+  struct frame *f = *ew->emacs_frame.framep;
   struct x_output *x = f->output_data.x;
 
   ew->core.height = FRAME_PIXEL_HEIGHT (f) - x->menubar_height;
@@ -359,7 +360,7 @@ EmacsFrameInitialize (Widget request, Widget new,
 {
   EmacsFrame ew = (EmacsFrame) new;
 
-  if (!ew->emacs_frame.frame)
+  if (!*ew->emacs_frame.framep)
     {
       fputs ("can't create an emacs frame widget without a frame\n", stderr);
       exit (1);
@@ -384,7 +385,7 @@ EmacsFrameRealize (Widget widget, XtValueMask *mask,
 		   XSetWindowAttributes *attrs)
 {
   EmacsFrame ew = (EmacsFrame) widget;
-  struct frame *f = ew->emacs_frame.frame;
+  struct frame *f = *ew->emacs_frame.framep;
 
   /* This used to contain SubstructureRedirectMask, but this turns out
      to be a problem with XIM on Solaris, and events from that mask
@@ -410,14 +411,21 @@ EmacsFrameRealize (Widget widget, XtValueMask *mask,
 static void
 EmacsFrameDestroy (Widget widget)
 {
-  /* All GCs are now freed in x_free_frame_resources.  */
+  EmacsFrame ew = (EmacsFrame) widget;
+  struct frame **fp = ew->emacs_frame.framep;
+
+#ifdef HAVE_MPS
+  igc_xfree (fp);
+#else
+  xfree (fp);
+#endif
 }
 
 static void
 EmacsFrameResize (Widget widget)
 {
   EmacsFrame ew = (EmacsFrame) widget;
-  struct frame *f = ew->emacs_frame.frame;
+  struct frame *f = *ew->emacs_frame.framep;
 
   if (CONSP (frame_size_history))
     frame_size_history_extra
@@ -470,7 +478,7 @@ EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request,
 EmacsFrameSetCharSize (Widget widget, int columns, int rows)
 {
   EmacsFrame ew = (EmacsFrame) widget;
-  struct frame *f = ew->emacs_frame.frame;
+  struct frame *f = *ew->emacs_frame.framep;
 
   if (CONSP (frame_size_history))
     frame_size_history_extra
@@ -489,7 +497,7 @@ EmacsFrameSetCharSize (Widget widget, int columns, int rows)
 EmacsFrameExpose (Widget widget, XEvent *event, Region region)
 {
   EmacsFrame ew = (EmacsFrame) widget;
-  struct frame *f = ew->emacs_frame.frame;
+  struct frame *f = *ew->emacs_frame.framep;
 
   expose_frame (f, event->xexpose.x, event->xexpose.y,
 		event->xexpose.width, event->xexpose.height);
@@ -501,7 +509,7 @@ EmacsFrameExpose (Widget widget, XEvent *event, Region region)
 widget_store_internal_border (Widget widget)
 {
   EmacsFrame ew = (EmacsFrame) widget;
-  struct frame *f = ew->emacs_frame.frame;
+  struct frame *f = *ew->emacs_frame.framep;
 
   ew->emacs_frame.internal_border_width = f->internal_border_width;
 }
diff --git a/src/widgetprv.h b/src/widgetprv.h
index b9cd72a4bc2..e63bbda1fe3 100644
--- a/src/widgetprv.h
+++ b/src/widgetprv.h
@@ -25,7 +25,7 @@ #define _EmacsFrameP_h
 #include <X11/CoreP.h>
 
 typedef struct {
-  struct frame *frame;		/* the *emacs* frame object */
+  struct frame **framep;		/* the *emacs* frame object */
 
   /* Resources that can't be done from lisp.
    */
diff --git a/src/xfns.c b/src/xfns.c
index 3f0d8f3fcd0..53ad460903b 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -24,6 +24,7 @@ Copyright (C) 1989, 1992-2024 Free Software Foundation, Inc.
 #include <unistd.h>
 
 #include "lisp.h"
+#include "igc.h"
 #include "character.h"
 #include "xterm.h"
 #include "frame.h"
@@ -4195,12 +4196,20 @@ x_window (struct frame *f, long window_prompting)
   /* mappedWhenManaged to false tells to the paned window to not map/unmap
      the emacs screen when changing menubar.  This reduces flickering.  */
 
+  struct frame **framep;
+#ifdef HAVE_MPS
+  framep = igc_xzalloc_ambig (sizeof *framep);
+#else
+  framep = xmalloc (sizeof *framep);
+#endif
+  *framep = f;
+
   ac = 0;
   XtSetArg (al[ac], XtNmappedWhenManaged, 0); ac++;
   XtSetArg (al[ac], (char *) XtNshowGrip, 0); ac++;
   XtSetArg (al[ac], (char *) XtNallowResize, 1); ac++;
   XtSetArg (al[ac], (char *) XtNresizeToPreferred, 1); ac++;
-  XtSetArg (al[ac], (char *) XtNemacsFrame, f); ac++;
+  XtSetArg (al[ac], (char *) XtNemacsFrame, framep); ac++;
   XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++;
   XtSetArg (al[ac], XtNdepth, FRAME_DISPLAY_INFO (f)->n_planes); ac++;
   XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++;

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  2024-08-05 16:40   ` Pip Cet
@ 2024-08-05 16:50     ` Eval Exec
  2024-08-05 17:45     ` Eli Zaretskii
  2024-08-08 16:56     ` Eval Exec
  2 siblings, 0 replies; 21+ messages in thread
From: Eval Exec @ 2024-08-05 16:50 UTC (permalink / raw)
  To: Pip Cet; +Cc: emacs-devel

Thank you! I'll try this PATCH. :heart:

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



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  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-08 16:56     ` Eval Exec
  2 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2024-08-05 17:45 UTC (permalink / raw)
  To: Pip Cet; +Cc: execvy, emacs-devel

> Date: Mon, 05 Aug 2024 16:40:50 +0000
> From: Pip Cet <pipcet@protonmail.com>
> Cc: Eval Exec <execvy@gmail.com>, emacs-devel@gnu.org
> 
> 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

The inclusion of igc.h should be conditioned by HAVE_MPS.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  2024-08-05 17:45     ` Eli Zaretskii
@ 2024-08-05 18:00       ` Pip Cet
  2024-08-05 18:19         ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Pip Cet @ 2024-08-05 18:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: execvy, emacs-devel

"Eli Zaretskii" <eliz@gnu.org> writes:

>> Date: Mon, 05 Aug 2024 16:40:50 +0000
>> From: Pip Cet <pipcet@protonmail.com>
>> Cc: Eval Exec <execvy@gmail.com>, emacs-devel@gnu.org
>>
>> 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
>
> The inclusion of igc.h should be conditioned by HAVE_MPS.

Thanks. I think we currently include igc.h unconditionally and igc.h
should start with #ifdef HAVE_MPS; but I see now that I accidentally
broke that by making enum igc_obj_type public unconditionally.

Can you clarify whether you prefer to wrap each #include or the entire
igc.h file in #ifdef HAVE_MPS?

Thanks,
Pip




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  2024-08-05 18:00       ` Pip Cet
@ 2024-08-05 18:19         ` Eli Zaretskii
  0 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2024-08-05 18:19 UTC (permalink / raw)
  To: Pip Cet; +Cc: execvy, emacs-devel

> Date: Mon, 05 Aug 2024 18:00:00 +0000
> From: Pip Cet <pipcet@protonmail.com>
> Cc: execvy@gmail.com, emacs-devel@gnu.org
> 
> "Eli Zaretskii" <eliz@gnu.org> writes:
> 
> > The inclusion of igc.h should be conditioned by HAVE_MPS.
> 
> Thanks. I think we currently include igc.h unconditionally and igc.h
> should start with #ifdef HAVE_MPS; but I see now that I accidentally
> broke that by making enum igc_obj_type public unconditionally.
> 
> Can you clarify whether you prefer to wrap each #include or the entire
> igc.h file in #ifdef HAVE_MPS?

I just did, didn't I? ;-)



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [MPS-test] scratch/igc branch (commit: 42731228d24) crashed
  2024-08-05 16:40   ` Pip Cet
  2024-08-05 16:50     ` Eval Exec
  2024-08-05 17:45     ` Eli Zaretskii
@ 2024-08-08 16:56     ` Eval Exec
  2 siblings, 0 replies; 21+ messages in thread
From: Eval Exec @ 2024-08-08 16:56 UTC (permalink / raw)
  To: Pip Cet; +Cc: emacs-devel

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



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-08-08 16:56 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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).