hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.05k stars 881 forks source link

foot-server crash sometimes: `wayland: failed to roundtrip Wayland display: Connection reset by peer`? #6310

Closed rtgiskard closed 4 weeks ago

rtgiskard commented 4 months ago

System Info and Version

System/Version info ```sh Hyprland, built from branch makepkg at commit a54ab301602e205f273969c093cf494d38ba4a98 (cmake: make xcb-errors required). Date: Sat Jun 1 04:07:00 2024 Tag: v0.40.0-146-ga54ab301, commits: 4752 flags: (if any) System Information: System name: Linux Node name: rt Release: 6.9.1-gskd Version: #1 SMP PREEMPT_DYNAMIC Sat, 18 May 2024 12:07:02 +0000 GPU information: c7:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Phoenix1 [1002:15bf] (rev c2) (prog-if 00 [VGA controller]) os-release: NAME="Arch Linux" PRETTY_NAME="Arch Linux" ID=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://archlinux.org/" DOCUMENTATION_URL="https://wiki.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=archlinux-logo plugins: ```

Bug or Regression?

Bug

Description

I'm using foot terminal with hyprland, sometimes foot-server service get crashed and all the terminal get killed, which is the biggest problem for the days with hyprland.

Well, it's not very frequent, maybe tens of hours per crash. Though, I've tried to debug with it in the past days, still no progress.

Here is the latest fresh log related to the crash of foot-server, seems to be related to wayland display reset? The log is related to the two api of wayland in foot source:

        if (wl_display_read_events(wayl->display) < 0) {
            LOG_ERRNO("failed to read events from the Wayland socket");
            return false;
        }
void
wayl_roundtrip(struct wayland *wayl)
{
    wl_display_cancel_read(wayl->display);
    if (wl_display_roundtrip(wayl->display) < 0) {
        LOG_ERRNO("failed to roundtrip Wayland display");
        return;
    }

    /* I suspect the roundtrip above clears the pending queue, and
     * that prepare_read() will always succeed in the first call. But,
     * better safe than sorry... */

    while (wl_display_prepare_read(wayl->display) != 0) {
        if (wl_display_dispatch_pending(wayl->display) < 0) {
            LOG_ERRNO("failed to dispatch pending Wayland events");
            return;
        }
    }
    wayl_flush(wayl);
}

I'm suspecting it's caused by hyprland, but have no evidence 😵

How to reproduce

No stable way to reproduce, more likely to happen on workspace switch, new window and etc.

Crash reports, logs, images, videos


Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:1447: failed to read events from the Wayland socket: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: warn: server.c:72: client FD=8: terminal still alive
Jun 02 19:23:05 rt foot[1817]: wayland: failed to read events from the Wayland socket: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: server: client FD=8: terminal still alive
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: warn: terminal.c:1904: slave exited with signal 1 (Hangup)
Jun 02 19:23:05 rt foot[1817]: terminal: slave exited with signal 1 (Hangup)
Jun 02 19:23:05 rt foot[1817]: warn: server.c:72: client FD=25: terminal still alive
Jun 02 19:23:05 rt foot[1817]: server: client FD=25: terminal still alive
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: warn: terminal.c:1904: slave exited with signal 1 (Hangup)
Jun 02 19:23:05 rt foot[1817]: terminal: slave exited with signal 1 (Hangup)
Jun 02 19:23:05 rt foot[1817]: warn: server.c:72: client FD=45: terminal still alive
Jun 02 19:23:05 rt foot[1817]: server: client FD=45: terminal still alive
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: warn: terminal.c:1904: slave exited with signal 1 (Hangup)
Jun 02 19:23:05 rt foot[1817]: terminal: slave exited with signal 1 (Hangup)
Jun 02 19:23:05 rt foot[1817]: warn: server.c:72: client FD=37: terminal still alive
Jun 02 19:23:05 rt foot[1817]: server: client FD=37: terminal still alive
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: warn: terminal.c:1904: slave exited with signal 1 (Hangup)
Jun 02 19:23:05 rt foot[1817]: terminal: slave exited with signal 1 (Hangup)
Jun 02 19:23:05 rt foot[1817]: warn: server.c:72: client FD=53: terminal still alive
Jun 02 19:23:05 rt foot[1817]: server: client FD=53: terminal still alive
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: warn: terminal.c:1904: slave exited with signal 1 (Hangup)
Jun 02 19:23:05 rt foot[1817]: terminal: slave exited with signal 1 (Hangup)
Jun 02 19:23:05 rt foot[1817]: warn: server.c:72: client FD=7: terminal still alive
Jun 02 19:23:05 rt foot[1817]: server: client FD=7: terminal still alive
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:2019: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: warn: terminal.c:1904: slave exited with signal 1 (Hangup)
Jun 02 19:23:05 rt foot[1817]: terminal: slave exited with signal 1 (Hangup)
Jun 02 19:23:05 rt foot[1817]:  err: wayland.c:1984: failed to flush wayland socket: Connection reset by peer
Jun 02 19:23:05 rt foot[1817]: wayland: failed to flush wayland socket: Connection reset by peer
Jun 02 19:23:05 rt systemd[1516]: foot-server.service: Main process exited, code=exited, status=230/PERSONALITY

And a related report on upstream: https://codeberg.org/dnkl/foot/issues/1708

While, as there is another big move, this issue is not too high a priority.

tienbuigia commented 4 months ago

I can confirm this issue only happen on Hyprland somehow. I use dwl daily, and sometimes switch to Hyprland, and encounter this issue.

vaxerski commented 4 months ago

can you get a log of foot crashing like this with WAYLAND_DEBUG=1?

rtgiskard commented 4 months ago

can you get a log of foot crashing like this with WAYLAND_DEBUG=1?

Let's wait the crash


Here is the log with WAYLAND_DEBUG=1, crash at 16:01:14: foot_crash_160114.log

rtgiskard commented 4 months ago

Another issue maybe related: occasionally, when press enter in foot, it print ;9;13~ rather than just enter:

> ~ $ df -hg;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~;9;13~^C

Sometimes, it's Tab, and print other outputs. Occasionally, not find stable way to reproduce.

> ~ $ fcitx5 --version
5.1.9
> ~ $ foot --version
foot version: 1.17.2 +pgo +ime +graphemes -assertions

> ~ $ journalctl -b -S "16:24:50" -U "16:25:40" > foot.input.log

log: foot.input.log

vaxerski commented 4 months ago

log looks truncated. Do you have an IME running perchance?

rtgiskard commented 4 months ago

log looks truncated. Do you have an IME running perchance?

Yes, it's fcitx5, well, this log may include what you need:

log with range: -S "2024-06-03 16:20" -U "2024-06-03 16:30" for the above issue foot.input.extend.log

abhinav3398 commented 2 months ago

Same here. But for me foot-server crashes whenever I use keyboard driven mouse tools (warpd and wl-kbptr).

rtgiskard commented 4 weeks ago

Seems to be fixed, not happend for long time

volfyd commented 3 weeks ago

On NixOS, I compiled foot with debugging to get more information. I don't have the error log at the moment but if someone else is using NixOS and is interested in debugging the issue, this can help. Here's the NixOS overlay.

    foot = {
      enable = true;
      package = (pkgs.foot.override {allowPgo = false;}).overrideAttrs (old: {
        mesonBuildType = "debug";
      });
    };

When I looked at it a while ago, foot was getting nonsense mouse events which triggered its assertions and it terminated itself.

Same here. But for me foot-server crashes whenever I use keyboard driven mouse tools (warpd and wl-kbptr).

In order to get around this bug, I switched away from all the mouse tools that talk wayland. Instead I wrote a script that drives the mouse with ydotool / ydotoold and its ABS positioning (option -A in 1.0.4 or option -T in master). You need to set the virtual mouse device to have a flat acceleration profile.