Skip to content

cosmic-comp silently drops Chromium/Electron Wayland clients (ECONNRESET, no wl_display.error) #2894

Closed

Description

@lkbddh

Edited Oct 3: this is not a regression. I've had it on three separate installs, long before these builds, including a fresh install after a few months on Windows. The first version blamed a commit range and named commits that aren't even in it. I've replaced that with what my logs actually show and what I've found in the code.

Chromium-family apps running native Wayland get their connection dropped by cosmic-comp several times a day on my machine. It isn't new: I've had it on three separate installs, going back well before these builds. On the current install it got much more frequent after the Sep 22 update (numbers below).

What happens

The app either dies at once with

ERROR:ui/events/platform/wayland/wayland_event_watcher.cc:78] Fatal Wayland communication error: Connection reset by peer.

or loses the socket, starts shutting down, and gets int3-trapped by Electron's 10 s session-loss shutdown watchdog when the shutdown doesn't finish in time:

kernel: traps: SessionLossShut[...] trap int3 ... in slack[...]
kernel: traps: OzoneShutdown W[...] trap int3 ... in paper-desktop[...]

Affected so far: Chrome 154, Brave, Slack 4.52, Paper (Electron 43/44), all native Wayland. cosmic-comp never crashes and logs nothing when it drops the client.

How often, on the current install

The kernel traps undercount badly, because they only fire when an Electron app takes longer than 10 s to shut down. A browser, or an Electron app that exits quickly, leaves no trace in the kernel log. The apps' own logs show the drops directly:

  • Slack logs a bare app.quit with no before-quit/will-quit when it's dropped, and the full sequence when I quit it. Its logs (from Sep 22) show 18 drops from Sep 22 to Oct 3. Only 5 of those line up with a kernel trap.
  • Paper logs Paper is quitting on a normal quit. Sessions that end without it, with no reboot or logout and not a second-instance handoff:
    • Sep 13 → Sep 22 12:46: 1 of 12 sessions (Sep 16 13:31)
    • Sep 22 12:46 → Oct 3: 31 of 49 sessions

So the Sep 22 update (cosmic-comp a557859 → cd881a4, plus the rest of COSMIC moving to 1.9, Chrome 153 → 154 and a glib update) made it much more frequent here, but it was already happening before. a557859..cd881a4 is only four commits (f9e02f4, a7349b7, 651f701, cd881a4), and none of them obviously touches client connections. Over the same weeks my disk was getting worse (see below), so I can't separate the two.

WAYLAND_DEBUG capture of a drop

Full trace: https://gist.github.com/lkbddh/97defdc0eab8a4c9ff57e5122455712e

Brave's last requests, 2 ms before the socket died:

[23:38:38.322]  -> wp_cursor_shape_device_v1#56.set_shape(20561463, 4)
[23:38:38.324]  -> wl_surface#63.attach(nil, 0, 0)
[23:38:38.324]  -> wl_surface#63.commit()
[23:38:38.324]  -> wl_subsurface#67.destroy()
[23:38:38.326] Fatal Wayland communication error: Connection reset by peer.

What comes before that matters more. Comparing wl_pointer.motion event times with the client's own timestamps, Brave fell up to 1.6 s behind the compositor. In its last 20 ms it dispatched 288 queued motion events, covering about 1 s of compositor time. It was working through a backlog when the socket died, so the subsurface destroy is probably just the last thing it happened to send. The old title blamed subsurface teardown; I no longer think that's the trigger.

Likely mechanism (from reading the code, not confirmed)

No wl_display.error reaches the client. Chromium CHECK-fails on any connection error other than EPIPE/ECONNRESET (WlDisplayCheckForErrors in ui/events/platform/wayland/wayland_event_watcher.cc). So the client did not receive a protocol error. Two server-side paths end that way:

  1. Outgoing buffer overflow. cosmic-comp uses wayland-backend's Rust backend, where each client's buffer is 4096 bytes (DEFAULT_MAX_BUFFER_SIZE, wayland-backend 0.3.15 src/rs/mod.rs:11). When a write fails because the client isn't reading, send_event calls self.kill(DisconnectReason::ConnectionClosed) and sends no error (src/rs/server_impl/client.rs:210-211). Neither cosmic-comp nor smithay calls set_default_max_buffer_size. A client that stalls under a stream of pointer motion would hit this, and that fits the lag above.
  2. A protocol error posted on an already-destroyed object, as in Ghostty quick terminal dies due broken pipe on hide #2159 / Commits to unmapped layer surfaces error after role object has been destroyed Smithay/smithay#1979. The client is killed, but the error never arrives.

State::disconnected (src/state.rs:178 at 0fbd457) gets the DisconnectReason but ignores it and logs nothing, so I can't tell these apart. Logging the reason and the client's pid there would settle it. If it's (1), raising the limit with set_default_max_buffer_size should help.

Other notes

  • surface missing from known popups is probably unrelated: 399 times Sep 13 → 22, 791 since. In smithay it's the line logged in place of an error when a destroyed popup commits again.
  • My clients were also stalling on disk I/O. The SSD wasn't getting TRIM through LUKS, writes averaged about 250 ms, and IO pressure was 65–87% during the Oct 3 drops. I fixed that on Oct 3. If it's path (1), the drops should become rarer but not stop, since any long enough stall can still trigger one.

Environment

Pop!_OS 24.04 LTS, kernel 7.1.5-76070105-generic, cosmic-comp 0.1~1790118748~24.04~0fbd457, ASUS laptop, Ryzen AI 9 HX 370 + RTX 4070 (NVIDIA 595.84, hybrid, AMD iGPU drives the session).

Related: #2159, Smithay/smithay#1979, #2658 (silent exits; one comment reports native-Wayland Chrome dying with "Broken pipe" on 0fbd457, AMD+NVIDIA), pop-os/cosmic-epoch#3630 (Chromium freeze/hang on COSMIC + NVIDIA hybrid), pop-os/cosmic-epoch#3417 + #2349 (popup tracking).

I have an apport SIGTRAP report with a core dump for paper-desktop, the full journals, and the WAYLAND_DEBUG trace. This happens several times a day here, so I'm happy to test patches or a debug build that logs the disconnect reason.

Activity

  1. changed the title [-]cosmic-comp silently severs Wayland connection of Chromium clients on subsurface teardown (regression in a557859..cd881a4)[/-] [+]cosmic-comp silently drops Chromium/Electron Wayland clients (ECONNRESET, no wl_display.error) since the Sep 22 COSMIC 1.9 update[/+] on Oct 4, 2026
  2. changed the title [-]cosmic-comp silently drops Chromium/Electron Wayland clients (ECONNRESET, no wl_display.error) since the Sep 22 COSMIC 1.9 update[/-] [+]cosmic-comp silently drops Chromium/Electron Wayland clients (ECONNRESET, no wl_display.error)[/+] on Oct 4, 2026
  3. A9G-Data-Droid commented on Oct 10, 2026

    @A9G-Data-Droid

    I have been struggling with this for a weeks and I couldn't live with it, so I undertook making a fix.

    I can regularly reproduce the silent ECONNRESET drops on Brave/Chromium with my monitor running at 144Hz and confirmed the root cause:

    wayland-backend defaults to a fixed 4 KiB limit (DEFAULT_MAX_BUFFER_SIZE). When high event rates (144Hz vblank / mouse pointer with a high report rate) coincide with brief client stalls, flush() returns WouldBlock, the buffer cannot expand, and wayland-backend terminates the client with self.kill(DisconnectReason::ConnectionClosed) without sending a protocol error.

    Enabling the libwayland_1_23 feature on wayland-server and wayland-backend exposes set_default_max_buffer_size. Increasing the default client max buffer size to 2 MiB in init_wayland_display resolved the drops completely.

    I am running my fixed binary on my Desktop and my computer is usable again. I have an example on this branch: https://github.com/A9G-Data-Droid/cosmic-comp/tree/fix-2894-vrr-texture-import

    I went to open a PR but I noticed that you don't accept PRs with LLM generated content. I am an AI engineer at my day job. I can open a PR if what I have here is acceptable. Or someone could look at my solution and rewrite it by hand if that is what you need to do. I'll be running my version until it gets fixed upstream.

  4. 81reap commented on Oct 24, 2026

    @81reap

    I've run into this issue a few times on my NixOS machine. I thought it was just a transient thing since logs don't show any obvios signs of crashing but after the Nth time of it happening I put claude-code on the case.

    my machine and env

    • NixOS 26.11 (nixpkgs e7439b6), kernel 6.18.55
    • AMD Ryzen 7 5800X3D, 64 GiB RAM, Gigabyte B550I AORUS PRO AX
    • cosmic-comp 1.9.0 built from tag epoch-1.9.0
    • NVIDIA RTX 4000 SFF Ada, open kernel module 595.104.02, single GPU driving the session
    • One monitor: BenQ RD280UG, 3840x2560 at 60 Hz, 150% scale, adaptive sync set to automatic
    • VS Code 1.140.0 (Electron 43.7.3, Chrome 150), ungoogled-chromium 154.0.8037.97, both started with --ozone-platform-hint=auto (NIXOS_OZONE_WL=1)

    what happened?

    VS Code (Electron 43.7.3) and ungoogled-chromium 154, both native Wayland, exited 133 ms apart. Both had been running for 8 days:

    15:03:57.774 systemd[1245]: app-org.chromium.Chromium-6193.scope: Consumed 1h 9min CPU time ...
    15:03:57.907 systemd[1245]: app-cosmic-code-3526.scope: Consumed 4h 2min CPU time ...
    
    • No core dump in coredumpctl, no new Crashpad report from either app, and no OOM kill.
    • Discord (native Wayland, idle in the background) and Steam (XWayland) kept running.
    • cosmic-comp did not crash and logged nothing about either client disconnecting.
    • I don't have the Chromium error line. COSMIC started both apps with stderr pointed at /dev/null.
    • Anecdotaly this happens more often with Chromium than vscode

    suspected root cause

    At the time of the crash, Steam was trying to update Fallout 76 but my drive had one bad sector that the game was installed on. Steam read about 500 MiB/s from the disk without stopping and set off ATA error recovery over and over (Unrecovered read error - auto reallocate failed, 1,131 times since 03:06). The same disk holds /nix/store, /home and swap, so any page fault in either app had to wait behind that. About 10 minutes after the drop, /proc/pressure/io read some avg300=19.52 and full avg300=15.45. I didn't record pressure at the moment of the drop itself

    This matches what the outgoing buffer issue called out in the orignal report :: clients stalled on disk I/O, and the drops got rarer once the disk was fixed (uninstalling Fallout 76 and reinstalling it in my case). A client that stops reading for a moment while the compositor keeps sending events would fill the 4 KiB per-client buffer. The compositor then calls kill(DisconnectReason::ConnectionClosed) without sending a protocol error.

    surface missing from known popups appears 344 times in my boot's cosmic-comp log (8 days), but I suspect it's probably unrelated.

    workaround

    I'm currently running badblocks and S.M.A.R.T. scans to find any other bad blocks/sectors on my drive to fix those by moving files and folders off of those blocks/sectors. I wrote about these tools on my blog if others want to try scanning their own drives https://prayag.bhakar.org/blog/post/being-smart-about-used-storage

  5. tobico commented on Oct 28, 2026

    @tobico

    I've been running into this issue with Brave. I have a 144hz monitor and high refresh rate gaming mouse, and frequently run multiple rust compilations in the background. A lag spike of around 5 seconds from Brave, often associated with loading a YouTube video, causes it to get terminated.

    Here's a log I was able to capture of the issue in action:

      [1781167:1781167:1029/083555.165526:INFO:CONSOLE:0] "Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.", source: about:blank (0)
      [1781167:1781167:1029/083555.498466:INFO:CONSOLE:0] "Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.", source: about:blank (0)
      [1781167:1781167:1029/083556.164699:INFO:CONSOLE:0] "Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.", source: about:blank (0)
      [1781167:1781167:1029/083556.498136:INFO:CONSOLE:0] "Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.", source: about:blank (0)
      [1781167:1781167:1029/083601.491167:ERROR:ui/events/platform/wayland/wayland_event_watcher.cc:358] Fatal Wayland communication error: Broken pipe.
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions