adlocode / xfwm4

GNU General Public License v2.0
97 stars 4 forks source link

[wlroots] Crash when running `xfwm4-wayland gnome-terminal` from a tty #3

Open Tamaranch opened 1 year ago

Tamaranch commented 1 year ago

wlroots branch at commit 283ee90867e323bdf6a1f110a7aa71264546e9e8

Backtrace:

Core was generated by `xfwm4-wayland gnome-terminal'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f86770ecdc5 in realloc () from /usr/bin/../lib/libc.so.6
[Current thread is 1 (Thread 0x7f8676094940 (LWP 22258))]
(gdb) bt
#0  0x00007f86770ecdc5 in realloc () at /usr/bin/../lib/libc.so.6
#1  0x00007f86776ca3da in wl_array_add () at /usr/bin/../lib/libwayland-server.so.0
#2  0x00007f86776cb50e in  () at /usr/bin/../lib/libwayland-server.so.0
#3  0x00007f86776cb7dc in wl_resource_create () at /usr/bin/../lib/libwayland-server.so.0
#4  0x000055e1bcb4b5db in create_toplevel_resource_for_resource (toplevel=0x55e1bdc5a310, manager_resource=0x55e1bde5b0f0) at ../src/wayland/compositor/xfwm-shell.c:549
#5  0x000055e1bcb4b7c1 in xfwm_shell_window_create (manager=0x55e1bdbaba80) at ../src/wayland/compositor/xfwm-shell.c:594
#6  0x000055e1bcb42fa6 in hopalong_xdg_surface_map (listener=0x55e1bdc69cc8, data=0x55e1bdbc0f10) at ../src/wayland/compositor/hopalong-xdg.c:55
#7  0x000055e1bcb4a814 in wlr_signal_emit_safe (signal=0x55e1bdbc1008, data=0x55e1bdbc0f10) at /run/media/user/Free/Système/Linux/Git/xfwm4-wayland/util/signal.c:45
#8  0x00007f867731c8f8 in  () at /usr/bin/../lib/libwlroots.so.10
#9  0x00007f86770524f6 in  () at /usr/bin/../lib/libffi.so.8
#10 0x00007f867704ef5e in  () at /usr/bin/../lib/libffi.so.8
#11 0x00007f8677051b73 in ffi_call () at /usr/bin/../lib/libffi.so.8
#12 0x00007f86776c6ada in  () at /usr/bin/../lib/libwayland-server.so.0
#13 0x00007f86776cb01c in  () at /usr/bin/../lib/libwayland-server.so.0
#14 0x00007f86776c99e2 in wl_event_loop_dispatch () at /usr/bin/../lib/libwayland-server.so.0
#15 0x00007f86776ca197 in wl_display_run () at /usr/bin/../lib/libwayland-server.so.0
#16 0x000055e1bcb41622 in hopalong_server_run (server=0x55e1bd366130) at ../src/wayland/compositor/hopalong-server.c:177
#17 0x000055e1bcb4a70e in main (argc=2, argv=0x7ffed9e960a8, envp=0x7ffed9e960c0) at ../src/wayland/compositor/hopalong-main.c:218
adlocode commented 1 year ago

Oh is that how that works? By typing the command you want to run straight after xfwm4-wayland? I've never used that feature, I just run things by switching to another tty, running my command, and then switching back to the tty my compositor is on.

Has my latest commit 7d695e2 fixed it?

Tamaranch commented 1 year ago

Oh is that how that works?

I guess so:

$ xfwm4-wayland --help
usage: hopalong [options] [program]

If [program] is specified, it will be launched to start a session.

Doesn't xfwm4-wayland replace hopalong?

Has my latest commit 7d695e2 fixed it?

No:

Core was generated by `xfwm4-wayland gnome-terminal'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f0513b0fd20 in wl_resource_post_event () from /usr/bin/../lib/libwayland-server.so.0
[Current thread is 1 (Thread 0x7f05124d2940 (LWP 11397))]
(gdb) bt
#0  0x00007f0513b0fd20 in wl_resource_post_event () at /usr/bin/../lib/libwayland-server.so.0
#1  0x000056364444692d in zxfwm_shell_send_toplevel (resource_=0x563646027980, toplevel=0x563645fe1410) at ./protocol/xfway-shell-protocol.h:175
#2  0x00005636444476bb in create_toplevel_resource_for_resource (toplevel=0x563645d83380, manager_resource=0x563646027980) at ../src/wayland/compositor/xfwm-shell.c:561
#3  0x0000563644447830 in xfwm_shell_window_create (manager=0x563645d6da60) at ../src/wayland/compositor/xfwm-shell.c:594
#4  0x000056364443efa6 in hopalong_xdg_surface_map (listener=0x563645dc9498, data=0x563645e284c0) at ../src/wayland/compositor/hopalong-xdg.c:57
#5  0x0000563644446883 in wlr_signal_emit_safe (signal=0x563645e285b8, data=0x563645e284c0) at /run/media/user/Free/Système/Linux/Git/xfwm4-wayland/util/signal.c:45
#6  0x00007f05137638f8 in  () at /usr/bin/../lib/libwlroots.so.10
#7  0x00007f05134994f6 in  () at /usr/bin/../lib/libffi.so.8
#8  0x00007f0513495f5e in  () at /usr/bin/../lib/libffi.so.8
#9  0x00007f0513498b73 in ffi_call () at /usr/bin/../lib/libffi.so.8
#10 0x00007f0513b0dada in  () at /usr/bin/../lib/libwayland-server.so.0
#11 0x00007f0513b1201c in  () at /usr/bin/../lib/libwayland-server.so.0
#12 0x00007f0513b109e2 in wl_event_loop_dispatch () at /usr/bin/../lib/libwayland-server.so.0
#13 0x00007f0513b11197 in wl_display_run () at /usr/bin/../lib/libwayland-server.so.0
#14 0x000056364443d622 in hopalong_server_run (server=0x563645528130) at ../src/wayland/compositor/hopalong-server.c:177
#15 0x000056364444677d in main (argc=2, argv=0x7fffc65526e8, envp=0x7fffc6552700) at ../src/wayland/compositor/hopalong-main.c:218
adlocode commented 1 year ago

Does it still happen with xfce4-terminal or weston-terminal?

Are you running xfwm4-wayland from the build directory or have you installed it? The compositor consists of two binaries so it won't be able to find the other binary if it's not installed.

Tamaranch commented 1 year ago

Does it still happen with xfce4-terminal or weston-terminal?

Yes, and backtraces go more or less far sometimes but it seems to be always the same way (buit from 1eb122280ee8787121c4a5687870b2041c25f940 on the wayland branch now):

Core was generated by `xfwm4-wayland gnome-terminal'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f1314524814 in ?? () from /usr/bin/../lib/libwayland-server.so.0
[Current thread is 1 (Thread 0x7f1312ee6940 (LWP 9500))]
(gdb) bt
#0  0x00007f1314524814 in  () at /usr/bin/../lib/libwayland-server.so.0
#1  0x00007f1314524fdb in wl_client_destroy () at /usr/bin/../lib/libwayland-server.so.0
#2  0x00007f13145254ce in  () at /usr/bin/../lib/libwayland-server.so.0
#3  0x00007f13145249e2 in wl_event_loop_dispatch () at /usr/bin/../lib/libwayland-server.so.0
#4  0x00007f1314525197 in wl_display_run () at /usr/bin/../lib/libwayland-server.so.0
#5  0x000055cc3fecc692 in hopalong_server_run (server=0x55cc40aff130) at ../src/wayland/compositor/hopalong-server.c:177
#6  0x000055cc3fed58ba in main (argc=2, argv=0x7ffcfdd9e138, envp=0x7ffcfdd9e150) at ../src/wayland/compositor/hopalong-main.c:218
Core was generated by `xfwm4-wayland xfce4-terminal'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f4c7c79b4ca in ?? () from /usr/bin/../lib/libwayland-server.so.0
[Current thread is 1 (Thread 0x7f4c7b15b940 (LWP 9772))]
(gdb) bt
#0  0x00007f4c7c79b4ca in  () at /usr/bin/../lib/libwayland-server.so.0
#1  0x00007f4c7c79b7dc in wl_resource_create () at /usr/bin/../lib/libwayland-server.so.0
#2  0x000055fba8715787 in create_toplevel_resource_for_resource (toplevel=0x55fbaae29020, manager_resource=0x55fbab021460) at ../src/wayland/compositor/xfwm-shell.c:550
#3  0x000055fba871596d in xfwm_shell_window_create (shell=0x55fbaad572d0) at ../src/wayland/compositor/xfwm-shell.c:595
#4  0x000055fba870d016 in hopalong_xdg_surface_map (listener=0x55fbaadc9928, data=0x55fbab012c00) at ../src/wayland/compositor/hopalong-xdg.c:58
#5  0x000055fba87149c0 in wlr_signal_emit_safe (signal=0x55fbab012cf8, data=0x55fbab012c00) at /run/media/user/Free/Système/Linux/Git/xfwm4-wayland/util/signal.c:45
#6  0x00007f4c7c3ec8f8 in  () at /usr/bin/../lib/libwlroots.so.10
#7  0x00007f4c7c1224f6 in  () at /usr/bin/../lib/libffi.so.8
#8  0x00007f4c7c11ef5e in  () at /usr/bin/../lib/libffi.so.8
#9  0x00007f4c7c121b73 in ffi_call () at /usr/bin/../lib/libffi.so.8
#10 0x00007f4c7c796ada in  () at /usr/bin/../lib/libwayland-server.so.0
#11 0x00007f4c7c79b01c in  () at /usr/bin/../lib/libwayland-server.so.0
#12 0x00007f4c7c7999e2 in wl_event_loop_dispatch () at /usr/bin/../lib/libwayland-server.so.0
#13 0x00007f4c7c79a197 in wl_display_run () at /usr/bin/../lib/libwayland-server.so.0
#14 0x000055fba870b692 in hopalong_server_run (server=0x55fbaa3b4130) at ../src/wayland/compositor/hopalong-server.c:177
#15 0x000055fba87148ba in main (argc=2, argv=0x7ffc28706a48, envp=0x7ffc28706a60) at ../src/wayland/compositor/hopalong-main.c:218
Core was generated by `xfwm4-wayland weston-terminal'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007effd763acb1 in wl_list_insert_list () from /usr/bin/../lib/libwayland-server.so.0
[Current thread is 1 (Thread 0x7effd5ffc940 (LWP 9922))]
(gdb) bt
#0  0x00007effd763acb1 in wl_list_insert_list () at /usr/bin/../lib/libwayland-server.so.0
#1  0x00007effd763ad00 in  () at /usr/bin/../lib/libwayland-server.so.0
#2  0x00007effd763c7b9 in wl_resource_create () at /usr/bin/../lib/libwayland-server.so.0
#3  0x000056466a379787 in create_toplevel_resource_for_resource (toplevel=0x56466b1d2eb0, manager_resource=0x56466b141be0) at ../src/wayland/compositor/xfwm-shell.c:550
#4  0x000056466a37996d in xfwm_shell_window_create (shell=0x56466ae7f2d0) at ../src/wayland/compositor/xfwm-shell.c:595
#5  0x000056466a371016 in hopalong_xdg_surface_map (listener=0x56466af42318, data=0x56466af44360) at ../src/wayland/compositor/hopalong-xdg.c:58
#6  0x000056466a3789c0 in wlr_signal_emit_safe (signal=0x56466af44458, data=0x56466af44360) at /run/media/user/Free/Système/Linux/Git/xfwm4-wayland/util/signal.c:45
#7  0x00007effd728d8f8 in  () at /usr/bin/../lib/libwlroots.so.10
#8  0x00007effd6fc34f6 in  () at /usr/bin/../lib/libffi.so.8
#9  0x00007effd6fbff5e in  () at /usr/bin/../lib/libffi.so.8
#10 0x00007effd6fc2b73 in ffi_call () at /usr/bin/../lib/libffi.so.8
#11 0x00007effd7637ada in  () at /usr/bin/../lib/libwayland-server.so.0
#12 0x00007effd763c01c in  () at /usr/bin/../lib/libwayland-server.so.0
#13 0x00007effd763a9e2 in wl_event_loop_dispatch () at /usr/bin/../lib/libwayland-server.so.0
#14 0x00007effd763b197 in wl_display_run () at /usr/bin/../lib/libwayland-server.so.0
#15 0x000056466a36f692 in hopalong_server_run (server=0x56466a4dc130) at ../src/wayland/compositor/hopalong-server.c:177
#16 0x000056466a3788ba in main (argc=2, argv=0x7ffc0622c0f8, envp=0x7ffc0622c110) at ../src/wayland/compositor/hopalong-main.c:218

Are you running xfwm4-wayland from the build directory or have you installed it?

The latter.

soreau commented 1 year ago

I think the problem might be that xfwm4-wayland starts xfwm4 but it crashes, leaving a dangling pointer in shell->resources. The resource is inserted in bind_desktop_shell but not removed in unbind_desktop_shell. Later, when a client is started, it tries to use the resource and crashes. Does this patch help?

Tamaranch commented 1 year ago

Yes, it fixes the issue. This branch is dead though I think, new developments take place on wayland-2.

Consolatis commented 1 year ago

I am a bit confused, where is that wayland-2 branch? I can't find it in this repo. I tried the wayland one and got it somewhat working but I wonder if its the current branch.