emersion / mako

A lightweight Wayland notification daemon
https://wayland.emersion.fr/mako
MIT License
2.18k stars 139 forks source link

Segmentation fault after updating wlroots/sway #441

Closed kamiyaa closed 2 years ago

kamiyaa commented 2 years ago

mako git version 8417d1400b4ab3dd496da2cbfec7b21041833a7b

wlroots git version d3cb6b73a2733d8457a8be2593a42942b36b77e2 sway git version 6e023257e8e9a6673fc3ff69048cdaf8baa70044

I'm not sure what the exact cause is because the segfaults are unpredictable; it just happens a few minutes after starting mako and receiving some notifications. I modified mako to get a rough idea of where the segfault is happening and it seems to be segfaulting at wl_display_dispatch:

event-loop.c

...

if (loop->fds[MAKO_EVENT_WAYLAND].revents & POLLIN) {
      printf("wl_display_dispatch\n");
      printf("loop %p\n", loop);
      printf("loop->display %p\n", loop->display);
      ret = wl_display_dispatch(loop->display);
      if (ret < 0) {
            fprintf(stderr, "failed to read Wayland events\n");
            break;
      }
}
printf("Done\n");

...

Output

...
Done
loop
Done
loop
wl_display_dispatch
loop 0x7ffe83573840
loop->display 0x562debf12bd0
Done
loop
wl_display_dispatch
loop 0x7ffe83573840
loop->display 0x562debf12bd0
Segmentation fault
emersion commented 2 years ago

Please obtain a stack trace.

kamiyaa commented 2 years ago
Thread 1 "mako" received signal SIGSEGV, Segmentation fault.
pointer_handle_enter (data=0x555555590f90, wl_pointer=0x555555591d00, serial=1950, wl_surface=0x5555555ade50, surface_x=136966, surface_y=52603) at ../wayland.c:232
232         if (surface->surface_output->scale > scale) {
(gdb) backtrace
#0  pointer_handle_enter
    (data=0x555555590f90, wl_pointer=0x555555591d00, serial=1950, wl_surface=0x5555555ade50, surface_x=136966, surface_y=52603) at ../wayland.c:232
#1  0x00007ffff715205a in  () at /usr/lib64/libffi.so.8
#2  0x00007ffff715157f in  () at /usr/lib64/libffi.so.8
#3  0x00007ffff7b1c741 in  () at /usr/lib64/libwayland-client.so.0
#4  0x00007ffff7b18b0a in  () at /usr/lib64/libwayland-client.so.0
#5  0x00007ffff7b1a4ec in wl_display_dispatch_queue_pending () at /usr/lib64/libwayland-client.so.0
#6  0x000055555555f23e in run_event_loop (loop=0x7fffffffd6c0) at ../event-loop.c:273
#7  0x0000555555561d41 in main (argc=3, argv=0x7fffffffd928) at ../main.c:136
(gdb)