Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

firefox based browsers randomly cause system hang #253

Closed
enewbied opened this issue Jun 15, 2022 · 10 comments
Closed

firefox based browsers randomly cause system hang #253

enewbied opened this issue Jun 15, 2022 · 10 comments
Labels
A: bug Something isn't working Waiting reporter

Comments

@enewbied
Copy link

enewbied commented Jun 15, 2022

Info

dwl's commit: 8076b47
wlroots version: 0.15.1-5

Description

Any interaction with the browser has a chance in resulting with the system not responding to input from the keyboard and freezes the screen however audio started before hand continues to play even within the browser. Certain interactions like clicking a link, playing a video, and opening a new tab rarely result in the system hanging while dragging a tab from one window to another almost always results in the system hanging. Shutting down the system is the only thing possible after the hang.

@enewbied enewbied added the A: bug Something isn't working label Jun 15, 2022
@adambubenicek
Copy link

Happens to me too, few times a day, having to restart every time. Firefox indeed seems to be the culprit. I'd be happy to help debug, no idea where to start though.

@sevz17
Copy link
Collaborator

sevz17 commented Aug 25, 2022

You could SSH in, and run this command gdb --pid=$(pidof dwl) --ex 'set logging enabled on' --ex 'bt full' --ex 'exit' and send me gdb.txt

EDIT: dwl must be compiled with debug info (-O0 -g -ggdb3)

@adambubenicek
Copy link

Thank you very much, and sorry for the wait. I keep running a version compiled with those flags since you posted them, but the freeze hasn't happened since. The rate went from solid 3-4/day to literally 0/week. I'll still keep an eye on this, but perhaps it was a bug with Firefox.

@sevz17
Copy link
Collaborator

sevz17 commented Sep 4, 2022

Yeah, probably it was a bug from Firefox, but... just to make sure can you build dwl with your normal cflags and just add -g and try to reproduce the freeze

@adambubenicek
Copy link

Still going strong. Forgot to check versions initially, but can't reproduce the bug anymore with

dwl 1aacfad (with -g)
firefox 104.0.1-1
wlroots 0.15.1-6

Hopefully it sorted itself out for @enewbied too. Thanks!

@sevz17
Copy link
Collaborator

sevz17 commented Sep 23, 2022

@enewbied

@tomknig
Copy link

tomknig commented Nov 22, 2022

I have been running into the same problem. My system freezes multiple times a day. I am also using firefox, so that might be related. I am on:
dwl: f1639ba
firefox: 107.0
wlroots: 0.15.1-6

To help debugging this behavior, I followed your suggestion of compiling dwl with the -O0 -g -ggdb3 flags set and SSH-ed into the frozen system to retrieve the output from gdb --pid=$(pidof dwl) --ex 'set logging enabled on' --ex 'bt full' --ex 'exit'. Please find it attached here:

#0  0x00007fb37af220ef in write () at /usr/lib/libc.so.6
#1  0x00007fb37aea943d in _IO_file_write () at /usr/lib/libc.so.6
#2  0x00007fb37aea87e0 in  () at /usr/lib/libc.so.6
#3  0x00007fb37aeaa4b9 in _IO_do_write () at /usr/lib/libc.so.6
#4  0x00007fb37aea9afe in _IO_file_xsputn () at /usr/lib/libc.so.6
#5  0x00007fb37ae84e0e in  () at /usr/lib/libc.so.6
#6  0x00007fb37ae7a81f in printf () at /usr/lib/libc.so.6
#7  0x0000558af1ec71b6 in printstatus () at dwl.c:1907
        m = 0x558af2b5a3d0
        c = 0x558af2ebb950
        occ = 383
        urg = 0
        sel = 64
#8  0x0000558af1ec94df in updatetitle (listener=0x558af2ebba30, data=0x558af2e7db60) at dwl.c:2659
        c = 0x558af2ebb950
#9  0x00007fb37b174c5e in wlr_signal_emit_safe () at /usr/lib/libwlroots.so.10
#10 0x00007fb37aafa4f6 in  () at /usr/lib/libffi.so.8
#11 0x00007fb37aaf6f5e in  () at /usr/lib/libffi.so.8
#12 0x00007fb37aaf9b73 in ffi_call () at /usr/lib/libffi.so.8
#13 0x00007fb37b0dfada in  () at /usr/lib/libwayland-server.so.0
#14 0x00007fb37b0e4010 in  () at /usr/lib/libwayland-server.so.0
#15 0x00007fb37b0e29e2 in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0
#16 0x00007fb37b0e3197 in wl_display_run () at /usr/lib/libwayland-server.so.0
#17 0x0000558af1ec7865 in run (startup_cmd=0x7ffd6a5198e3 "autostart <&-") at dwl.c:2044
        socket = 0x558af2807bb9 "wayland-0"
#18 0x0000558af1eca044 in main (argc=3, argv=0x7ffd6a518508) at dwl.c:2890
        startup_cmd = 0x7ffd6a5198e3 "autostart <&-"
        c = -1
Detaching from program: /usr/local/bin/dwl, process 1945
[Inferior 1 (process 1945) detached]

Edit: A second freeze, that is somewhat reproducible happens when I drag and drop a file from nemo into a chromium-based browser. Firefox has not been started at this point. Stack:

#0  0x00007f69ced2f0ef in write () at /usr/lib/libc.so.6
#1  0x00007f69cecb643d in _IO_file_write () at /usr/lib/libc.so.6
#2  0x00007f69cecb57e0 in  () at /usr/lib/libc.so.6
#3  0x00007f69cecb74b9 in _IO_do_write () at /usr/lib/libc.so.6
#4  0x00007f69cecb6afe in _IO_file_xsputn () at /usr/lib/libc.so.6
#5  0x00007f69cec91e0e in  () at /usr/lib/libc.so.6
#6  0x00007f69cec8781f in printf () at /usr/lib/libc.so.6
#7  0x000055a29cc7204e in printstatus () at dwl.c:1894
        m = 0x55a29de83c40
        c = 0x55a29e149e30
        occ = 25
        urg = 0
        sel = 21922
#8  0x000055a29cc703f2 in focusclient (c=0x55a29e149e30, lift=0) at dwl.c:1252
        old = 0x55a29e161380
        i = 4
#9  0x000055a29cc71e70 in pointerfocus (c=0x55a29e149e30, surface=0x55a29e1497b0, sx=1287.7761977475768, sy=972.52711670426311, time=142486)
    at dwl.c:1856
        now = {tv_sec = 8589934595, tv_nsec = 17179869189}
        internal_call = 0
#10 0x000055a29cc71914 in motionnotify (time=142486) at dwl.c:1717
        sx = 1287.7761977475768
        sy = 972.52711670426311
        c = 0x55a29e149e30
        l = 0x7ffe9e809e40
        surface = 0x55a29e1497b0
        icon = 0x55a29e0fc7c0
#11 0x000055a29cc71990 in motionrelative (listener=0x55a29cc79790 <cursor_motion>, data=0x7ffe9e809f70) at dwl.c:1732
        event = 0x7ffe9e809f70
#12 0x00007f69cef81c5e in wlr_signal_emit_safe () at /usr/lib/libwlroots.so.10
#13 0x00007f69cef81c5e in wlr_signal_emit_safe () at /usr/lib/libwlroots.so.10
#14 0x00007f69cef40c6c in  () at /usr/lib/libwlroots.so.10
#15 0x00007f69ceeef9e2 in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0
#16 0x00007f69ceef0197 in wl_display_run () at /usr/lib/libwayland-server.so.0
#17 0x000055a29cc72865 in run (startup_cmd=0x7ffe9e80b8d1 "autostart <&-") at dwl.c:2044
        socket = 0x55a29db3c269 "wayland-0"
#18 0x000055a29cc75044 in main (argc=3, argv=0x7ffe9e80a398) at dwl.c:2890
        startup_cmd = 0x7ffe9e80b8d1 "autostart <&-"
        c = -1

@sevz17
Copy link
Collaborator

sevz17 commented Dec 2, 2022

I have been running into the same problem. My system freezes multiple times a day. I am also using firefox, so that might be related. I am on: dwl: f1639ba firefox: 107.0 wlroots: 0.15.1-6

To help debugging this behavior, I followed your suggestion of compiling dwl with the -O0 -g -ggdb3 flags set and SSH-ed into the frozen system to retrieve the output from gdb --pid=$(pidof dwl) --ex 'set logging enabled on' --ex 'bt full' --ex 'exit'. Please find it attached here:

#0  0x00007fb37af220ef in write () at /usr/lib/libc.so.6
#1  0x00007fb37aea943d in _IO_file_write () at /usr/lib/libc.so.6
#2  0x00007fb37aea87e0 in  () at /usr/lib/libc.so.6
#3  0x00007fb37aeaa4b9 in _IO_do_write () at /usr/lib/libc.so.6
#4  0x00007fb37aea9afe in _IO_file_xsputn () at /usr/lib/libc.so.6
#5  0x00007fb37ae84e0e in  () at /usr/lib/libc.so.6
#6  0x00007fb37ae7a81f in printf () at /usr/lib/libc.so.6
#7  0x0000558af1ec71b6 in printstatus () at dwl.c:1907
        m = 0x558af2b5a3d0
        c = 0x558af2ebb950
        occ = 383
        urg = 0
        sel = 64
#8  0x0000558af1ec94df in updatetitle (listener=0x558af2ebba30, data=0x558af2e7db60) at dwl.c:2659
        c = 0x558af2ebb950
#9  0x00007fb37b174c5e in wlr_signal_emit_safe () at /usr/lib/libwlroots.so.10
#10 0x00007fb37aafa4f6 in  () at /usr/lib/libffi.so.8
#11 0x00007fb37aaf6f5e in  () at /usr/lib/libffi.so.8
#12 0x00007fb37aaf9b73 in ffi_call () at /usr/lib/libffi.so.8
#13 0x00007fb37b0dfada in  () at /usr/lib/libwayland-server.so.0
#14 0x00007fb37b0e4010 in  () at /usr/lib/libwayland-server.so.0
#15 0x00007fb37b0e29e2 in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0
#16 0x00007fb37b0e3197 in wl_display_run () at /usr/lib/libwayland-server.so.0
#17 0x0000558af1ec7865 in run (startup_cmd=0x7ffd6a5198e3 "autostart <&-") at dwl.c:2044
        socket = 0x558af2807bb9 "wayland-0"
#18 0x0000558af1eca044 in main (argc=3, argv=0x7ffd6a518508) at dwl.c:2890
        startup_cmd = 0x7ffd6a5198e3 "autostart <&-"
        c = -1
Detaching from program: /usr/local/bin/dwl, process 1945
[Inferior 1 (process 1945) detached]

Edit: A second freeze, that is somewhat reproducible happens when I drag and drop a file from nemo into a chromium-based browser. Firefox has not been started at this point. Stack:

#0  0x00007f69ced2f0ef in write () at /usr/lib/libc.so.6
#1  0x00007f69cecb643d in _IO_file_write () at /usr/lib/libc.so.6
#2  0x00007f69cecb57e0 in  () at /usr/lib/libc.so.6
#3  0x00007f69cecb74b9 in _IO_do_write () at /usr/lib/libc.so.6
#4  0x00007f69cecb6afe in _IO_file_xsputn () at /usr/lib/libc.so.6
#5  0x00007f69cec91e0e in  () at /usr/lib/libc.so.6
#6  0x00007f69cec8781f in printf () at /usr/lib/libc.so.6
#7  0x000055a29cc7204e in printstatus () at dwl.c:1894
        m = 0x55a29de83c40
        c = 0x55a29e149e30
        occ = 25
        urg = 0
        sel = 21922
#8  0x000055a29cc703f2 in focusclient (c=0x55a29e149e30, lift=0) at dwl.c:1252
        old = 0x55a29e161380
        i = 4
#9  0x000055a29cc71e70 in pointerfocus (c=0x55a29e149e30, surface=0x55a29e1497b0, sx=1287.7761977475768, sy=972.52711670426311, time=142486)
    at dwl.c:1856
        now = {tv_sec = 8589934595, tv_nsec = 17179869189}
        internal_call = 0
#10 0x000055a29cc71914 in motionnotify (time=142486) at dwl.c:1717
        sx = 1287.7761977475768
        sy = 972.52711670426311
        c = 0x55a29e149e30
        l = 0x7ffe9e809e40
        surface = 0x55a29e1497b0
        icon = 0x55a29e0fc7c0
#11 0x000055a29cc71990 in motionrelative (listener=0x55a29cc79790 <cursor_motion>, data=0x7ffe9e809f70) at dwl.c:1732
        event = 0x7ffe9e809f70
#12 0x00007f69cef81c5e in wlr_signal_emit_safe () at /usr/lib/libwlroots.so.10
#13 0x00007f69cef81c5e in wlr_signal_emit_safe () at /usr/lib/libwlroots.so.10
#14 0x00007f69cef40c6c in  () at /usr/lib/libwlroots.so.10
#15 0x00007f69ceeef9e2 in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0
#16 0x00007f69ceef0197 in wl_display_run () at /usr/lib/libwayland-server.so.0
#17 0x000055a29cc72865 in run (startup_cmd=0x7ffe9e80b8d1 "autostart <&-") at dwl.c:2044
        socket = 0x55a29db3c269 "wayland-0"
#18 0x000055a29cc75044 in main (argc=3, argv=0x7ffe9e80a398) at dwl.c:2890
        startup_cmd = 0x7ffe9e80b8d1 "autostart <&-"
        c = -1

Sorry for the long delay.
This is very rare, since you close child process' stdin, printf shouldn't block.
Can you apply this patch, and tell me if works?

commit 5d164c1568504282fe3edac112164aee24c159fc
Author: Leonardo Hernández Hernández <leohdz172@protonmail.com>
Date:   Thu Dec 1 22:21:10 2022 -0600

    Revert "force line-buffered stdout if stdout is not a tty"
    
    This reverts commit deb48ff48b186ff77a7e9d3b3ab724ff4c3c340f.

diff --git a/dwl.c b/dwl.c
index 3f6db50..9af43c0 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1664,6 +1664,7 @@ printstatus(void)
 				sel, urg);
 		printf("%s layout %s\n", m->wlr_output->name, m->lt[m->sellt]->symbol);
 	}
+	fflush(stdout);
 }
 
 void
@@ -1942,9 +1943,6 @@ setsel(struct wl_listener *listener, void *data)
 void
 setup(void)
 {
-	/* Force line-buffered stdout */
-	setvbuf(stdout, NULL, _IOLBF, 0);
-
 	/* The Wayland display is managed by libwayland. It handles accepting
 	 * clients from the Unix socket, manging Wayland globals, and so on. */
 	dpy = wl_display_create();

@tomknig
Copy link

tomknig commented Dec 2, 2022

Thanks for getting back to me on this, @sevz17! 🙂
I've successfully applied your patch and will keep you posted on how it goes. So far, I couldn't reproduce the nemo - drag&drop -> chromium freeze.

@tomknig
Copy link

tomknig commented Dec 9, 2022

No freezes ever since, while I had ~3 freezes per day before. I am pretty confident your patch solved the issue 🙂 Thank you!

@sevz17 sevz17 closed this as completed in c60f651 Dec 9, 2022
jordanisaacs pushed a commit to jordanisaacs/dwl-flake that referenced this issue Dec 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A: bug Something isn't working Waiting reporter
Projects
None yet
Development

No branches or pull requests

4 participants