egui icon indicating copy to clipboard operation
egui copied to clipboard

WSL OS error running simple program "Io error: Broken pipe (os error 32)" "Io error: Connection reset by peer (os error 104)"

Open ravatex opened this issue 1 year ago • 3 comments
trafficstars

Describe the bug

When I run the example problem from the eframe docs one of the following 2 errors come out (interchangeably):

Actual output:

Io error: Broken pipe (os error 32)
Io error: Broken pipe (os error 32)
Io error: Broken pipe (os error 32)
thread 'main' panicked at src/main.rs:9:7:
called `Result::unwrap()` on an `Err` value: WinitEventLoop(ExitFailure(1))
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/result.rs:1654:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/result.rs:1077:23
   4: eframe_egui_bug::main
             at ./src/main.rs:5:5
   5: core::ops::function::FnOnce::call_once
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

or

Io error: Connection reset by peer (os error 104)
Io error: Connection reset by peer (os error 104)
Io error: Connection reset by peer (os error 104)
thread 'main' panicked at src/main.rs:9:7:
called `Result::unwrap()` on an `Err` value: WinitEventLoop(ExitFailure(1))
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/result.rs:1654:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/result.rs:1077:23
   4: eframe_egui_bug::main
             at ./src/main.rs:5:5
   5: core::ops::function::FnOnce::call_once
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

os error 32 happens more often

To Reproduce Steps to reproduce the behavior:

I suspect this is due to running this on WSL, the code that reproduces this error is the example in the eframe docs, shown here:

main.rs

use eframe::egui;

fn main() {
    let native_options = eframe::NativeOptions::default();
    eframe::run_native(
        "My egui App",
        native_options,
        Box::new(|cc| Ok(Box::new(MyEguiApp::new(cc)))),
    ).unwrap();
}

#[derive(Default)]
struct MyEguiApp {}

impl MyEguiApp {
    fn new(cc: &eframe::CreationContext<'_>) -> Self {
        // Customize egui here with cc.egui_ctx.set_fonts and cc.egui_ctx.set_visuals.
        // Restore app state using cc.storage (requires the "persistence" feature).
        // Use the cc.gl (a glow::Context) to create graphics shaders and buffers that you can use
        // for e.g. egui::PaintCallback.
        Self::default()
    }
}

impl eframe::App for MyEguiApp {
    fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
        egui::CentralPanel::default().show(ctx, |ui| {
            ui.heading("Hello World!");
        });
    }
}

Cargo.toml with the patched version, the error remains even in 0.28 or 0.28.1 w/o the patch

[package]
name = "eframe_egui_bug"
version = "0.1.0"
edition = "2021"


[dependencies]

eframe= "0.28.1"
[patch.crates-io]
eframe = { git = "https://github.com/emilk/egui", branch = "master" }

[workspace]
resolver = "2"

run $ RUST_BACKTRACE=1 cargo run

Expected behavior

A window with Hello World on it. Eframe 0.23 worked on a previous project of mine but this version here no longer works.

Screenshots

For a split second the window appears

image

Desktop (please complete the following information):

  • OS:

    • Linux DESKTOP-27GAKSM 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
    • Distributor ID: Ubuntu
    • Description: Ubuntu 22.04.4 LTS
    • Release: 22.04
    • Codename: jammy
  • Version: 0.28.1

Additional context This is the first issue I've made, please inform me of any additional information I need to provide. Thank you.

ravatex avatar Aug 08 '24 18:08 ravatex

I solved this issue by moving the file over to the windows system, installing Rust via powershell (though im unsure if this is necessary), and then running via cargo as normal.

JusticeBaum avatar Oct 14 '24 22:10 JusticeBaum

The error happens in the WSL, not on the actual windows system. Cargo, the source, and all dependencies are contained in the WSL not on windows, and the program is run on the WSL not windows itself.

  • Info: the WSL installation is in Windows 10

ravatex avatar Oct 15 '24 08:10 ravatex

Yes but within WSL navigating over to the mounted Windows file system cd /mnt/c/Users/... and containing the project there solved the issue on my system; Other alternatives I've seen for this issue have been setting up X forwarding between WSL and Windows or building for Windows when compiling your project. The issue stems from linux and windows graphic drivers not playing nice

JusticeBaum avatar Oct 15 '24 15:10 JusticeBaum

I am having same issue. For me it also mentions the clipboard. Tried updating WSL (using Ubuntu btw), as well as all apt packages but to no avail.

...
2024-12-14T22:04:24.116Z DEBUG [eframe::native::glow_integration] Event::Resumed
2024-12-14T22:04:24.117Z DEBUG [eframe::native::glow_integration] trying to create glutin Display with config: ConfigTemplateBuilder { template: ConfigTemplate { color_buffer_type: Rgb { r_size: 8, g_size: 8, b_size: 8 }, alpha_size: 8, depth_size: 0, stencil_size: 0, num_samples: None, min_swap_interval: None, max_swap_interval: None, config_surface_types: ConfigSurfaceTypes(WINDOW), api: None, transparency: false, single_buffering: false, stereoscopy: None, float_pixels: false, max_pbuffer_width: None, hardware_accelerated: None, max_pbuffer_height: None, native_window: None } }
2024-12-14T22:04:24.238Z DEBUG [eframe::native::glow_integration] using the first config from config picker closure. config: Egl(Config { inner: Config { raw: EglConfig(0x55555700c670), display: Khr(0x555556e1c230) } })
2024-12-14T22:04:24.301Z DEBUG [sctk_adwaita::buttons] Ignoring "appmenu" button
2024-12-14T22:04:24.302Z DEBUG [egui_winit] Failed to set window size
2024-12-14T22:04:24.302Z DEBUG [eframe::native::glow_integration] successfully created GL Display with version: EGL 1.5 and supported features: DisplayFeatures(CONTEXT_ROBUSTNESS | CONTEXT_NO_ERROR | FLOAT_PIXEL_FORMAT | SWAP_CONTROL | CREATE_ES_CONTEXT | MULTISAMPLING_PIXEL_FORMATS | SRGB_FRAMEBUFFERS)
2024-12-14T22:04:24.302Z DEBUG [eframe::native::glow_integration] creating gl context using raw window handle: Some(Wayland(WaylandWindowHandle { surface: 0x55555701d9a0 }))
2024-12-14T22:04:24.322Z DEBUG [eframe::native::glow_integration] Initializing egui_winit for viewport "FFFF"
2024-12-14T22:04:24.499Z DEBUG [eframe::native::glow_integration] Creating a gl_surface for viewport "FFFF"
2024-12-14T22:04:24.504Z DEBUG [sctk] Bound new global [19] wl_seat v7
2024-12-14T22:04:24.506Z DEBUG [egui_glow::painter] 
opengl version: 4.1 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2
opengl renderer: D3D12 (Intel(R) UHD Graphics)
opengl vendor: Microsoft Corporation
2024-12-14T22:04:24.506Z DEBUG [egui_glow::shader_version] Shader version: Gl140 ("4.10").
2024-12-14T22:04:24.506Z DEBUG [egui_glow::painter] Shader header: "#version 140\n".
2024-12-14T22:04:24.506Z DEBUG [egui_glow::painter] SRGB texture Support: true
2024-12-14T22:04:36.292Z DEBUG [eframe] Using the glow renderer
2024-12-14T22:04:36.307Z DEBUG [sctk] Bound new global [11] wl_output v3
2024-12-14T22:04:36.307Z DEBUG [sctk] Bound new global [4] zxdg_output_manager_v1 v2
2024-12-14T22:04:36.307Z DEBUG [sctk] Bound new global [19] wl_seat v7
2024-12-14T22:04:36.314Z DEBUG [sctk] supported wl_shm format Argb8888
2024-12-14T22:04:36.314Z DEBUG [sctk] supported wl_shm format Xrgb8888
2024-12-14T22:04:36.314Z DEBUG [sctk] supported wl_shm format Rgb565
2024-12-14T22:04:36.314Z DEBUG [eframe::native::glow_integration] Event::Resumed
2024-12-14T22:04:36.314Z DEBUG [eframe::native::glow_integration] trying to create glutin Display with config: ConfigTemplateBuilder { template: ConfigTemplate { color_buffer_type: Rgb { r_size: 8, g_size: 8, b_size: 8 }, alpha_size: 8, depth_size: 0, stencil_size: 0, num_samples: None, min_swap_interval: None, max_swap_interval: None, config_surface_types: ConfigSurfaceTypes(WINDOW), api: None, transparency: false, single_buffering: false, stereoscopy: None, float_pixels: false, max_pbuffer_width: None, hardware_accelerated: None, max_pbuffer_height: None, native_window: None } }
2024-12-14T22:04:36.918Z DEBUG [eframe::native::glow_integration] using the first config from config picker closure. config: Egl(Config { inner: Config { raw: EglConfig(0x55555703ab80), display: Khr(0x555556e1c280) } })
2024-12-14T22:04:36.936Z DEBUG [sctk_adwaita::buttons] Ignoring "appmenu" button
2024-12-14T22:04:36.937Z DEBUG [eframe::native::glow_integration] successfully created GL Display with version: EGL 1.5 and supported features: DisplayFeatures(CONTEXT_ROBUSTNESS | CONTEXT_NO_ERROR | FLOAT_PIXEL_FORMAT | SWAP_CONTROL | CREATE_ES_CONTEXT | MULTISAMPLING_PIXEL_FORMATS | SRGB_FRAMEBUFFERS)
2024-12-14T22:04:36.937Z DEBUG [eframe::native::glow_integration] creating gl context using raw window handle: Some(Wayland(WaylandWindowHandle { surface: 0x555557012ce0 }))
2024-12-14T22:04:36.952Z DEBUG [eframe::native::glow_integration] Initializing egui_winit for viewport "FFFF"
2024-12-14T22:04:36.953Z DEBUG [eframe::native::glow_integration] Creating a gl_surface for viewport "FFFF"
2024-12-14T22:04:36.957Z DEBUG [sctk] Bound new global [19] wl_seat v7
2024-12-14T22:04:36.959Z DEBUG [egui_glow::painter] 
opengl version: 4.1 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2
opengl renderer: D3D12 (Intel(R) UHD Graphics)
opengl vendor: Microsoft Corporation
2024-12-14T22:04:36.959Z DEBUG [egui_glow::shader_version] Shader version: Gl140 ("4.10").
2024-12-14T22:04:36.959Z DEBUG [egui_glow::painter] Shader header: "#version 140\n".
2024-12-14T22:04:36.959Z DEBUG [egui_glow::painter] SRGB texture Support: true
2024-12-14T22:04:36.959Z DEBUG [egui_glow::painter] SRGB framebuffer Support: true
2024-12-14T22:04:36.965Z DEBUG [egui_glow::vao] GL version: "4.1 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2".
Io error: Broken pipe (os error 32)
Io error: Broken pipe (os error 32)
2024-12-14T22:04:37.953Z DEBUG [eframe::native::run] Received Event::LoopExiting - saving app state…
2024-12-14T22:04:37.985Z ERROR [arboard::platform::linux::x11] Worker thread errored with: Unknown error while interacting with the clipboard: Connection reset by peer (os error 104
2024-12-14T22:04:49.221Z DEBUG [eframe] Using the glow renderer
2024-12-14T22:04:49.235Z DEBUG [sctk] Bound new global [11] wl_output v3
2024-12-14T22:04:49.235Z DEBUG [sctk] Bound new global [4] zxdg_output_manager_v1 v2
2024-12-14T22:04:49.235Z DEBUG [sctk] Bound new global [19] wl_seat v7
2024-12-14T22:04:49.242Z DEBUG [sctk] supported wl_shm format Argb8888
2024-12-14T22:04:49.242Z DEBUG [sctk] supported wl_shm format Xrgb8888
2024-12-14T22:04:49.242Z DEBUG [sctk] supported wl_shm format Rgb565
2024-12-14T22:04:49.242Z DEBUG [eframe::native::glow_integration] Event::Resumed
2024-12-14T22:04:49.243Z DEBUG [eframe::native::glow_integration] trying to create glutin Display with config: ConfigTemplateBuilder { template: ConfigTemplate { color_buffer_type: Rgb { r_size: 8, g_size: 8, b_size: 8 }, alpha_size: 8, depth_size: 0, stencil_size: 0, num_samples: None, min_swap_interval: None, max_swap_interval: None, config_surface_types: ConfigSurfaceTypes(WINDOW), api: None, transparency: false, single_buffering: false, stereoscopy: None, float_pixels: false, max_pbuffer_width: None, hardware_accelerated: None, max_pbuffer_height: None, native_window: None } }
2024-12-14T22:04:53.014Z DEBUG [eframe::native::glow_integration] using the first config from config picker closure. config: Egl(Config { inner: Config { raw: EglConfig(0x55555703e540), display: Khr(0x555556e1c280) } })
2024-12-14T22:04:53.094Z DEBUG [sctk_adwaita::buttons] Ignoring "appmenu" button
2024-12-14T22:04:53.095Z DEBUG [eframe::native::glow_integration] successfully created GL Display with version: EGL 1.5 and supported features: DisplayFeatures(CONTEXT_ROBUSTNESS | CONTEXT_NO_ERROR | FLOAT_PIXEL_FORMAT | SWAP_CONTROL | CREATE_ES_CONTEXT | MULTISAMPLING_PIXEL_FORMATS | SRGB_FRAMEBUFFERS)
2024-12-14T22:04:53.095Z DEBUG [eframe::native::glow_integration] creating gl context using raw window handle: Some(Wayland(WaylandWindowHandle { surface: 0x555557012c40 }))
2024-12-14T22:04:53.138Z DEBUG [eframe::native::glow_integration] Initializing egui_winit for viewport "FFFF"
2024-12-14T22:04:53.256Z DEBUG [eframe::native::glow_integration] Creating a gl_surface for viewport "FFFF"
2024-12-14T22:04:53.260Z DEBUG [sctk] Bound new global [19] wl_seat v7
2024-12-14T22:04:53.262Z DEBUG [egui_glow::painter] 
opengl version: 4.1 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2
opengl renderer: D3D12 (Intel(R) UHD Graphics)
opengl vendor: Microsoft Corporation
2024-12-14T22:04:53.262Z DEBUG [egui_glow::shader_version] Shader version: Gl140 ("4.10").
2024-12-14T22:04:53.262Z DEBUG [egui_glow::painter] Shader header: "#version 140\n".
2024-12-14T22:04:53.262Z DEBUG [egui_glow::painter] SRGB texture Support: true
2024-12-14T22:04:53.262Z DEBUG [egui_glow::painter] SRGB framebuffer Support: true
2024-12-14T22:04:53.268Z DEBUG [egui_glow::vao] GL version: "4.1 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2".
Io error: Broken pipe (os error 32)
Io error: Broken pipe (os error 32)
2024-12-14T22:04:54.227Z DEBUG [eframe::native::run] Received Event::LoopExiting - saving app state…
2024-12-14T22:04:54.275Z ERROR [arboard::platform::linux::x11] Worker thread errored with: Unknown error while interacting with the clipboard: Connection reset by peer (os error 104)
2024-12-14T22:04:54.275Z ERROR [arboard::platform::linux::x11] Could not hand the clipboard data over to the clipboard manager: Unknown error while interacting with the clipboard: The X11 server closed the connection

My dependencies:

serde = { version = "1.0" }
serde_json = { version = "1.0" }
bytemuck = { version = "1.20" }

thiserror = { version = "2.0" }
log = { version = "0.4" }
simple_logger = { version = "5.0" }

serialport = { version = "4.6" }  # not used atm

egui = { version = "0.29" }
eframe = { version = "0.29" }

Btw, this happens when I use eframe::run_native (doesn't matter what example I try), not when using eframe::run_simple_native.

Jan-DT avatar Dec 14 '24 22:12 Jan-DT

A workaround for me was: After application launch the application window does not have focus. Focus a window from a different application by clicking in in the task bar or directly. Then focus your launched application.

Of course this is nothing for production but it does help for dev. Maybe this is also a hint for the root-cause ?

AndreasFuchsTPM avatar Apr 04 '25 11:04 AndreasFuchsTPM

you can run the app with "./YourApp > /dev/null". It worked for me.

yyc94 avatar May 05 '25 09:05 yyc94

I have this problem starting with egui = 0.25. With egui = 0.24 I do not run into this error.

michaelmdresser avatar Jul 17 '25 05:07 michaelmdresser

when you are making the native options for the frame

let native_options = eframe::NativeOptions {
        viewport : egui::ViewportBuilder::default().with_inner_size([640.0,320.0]).with_resizable(true),
        ..Default::default()
};

also mention the viewport with your desired size.

partg952 avatar Jul 27 '25 18:07 partg952

i may have solved it..

when you are making the native options for the frame

let native_options = eframe::NativeOptions {
        viewport : egui::ViewportBuilder::default().with_inner_size([640.0,320.0]).with_resizable(true),
        ..Default::default()
};

also mention the viewport with your desired size.

don't think that solved anything, but i tried it too and it worked somehow. i would like to mention that if i give it the inner size in a vec form, it results in the same error:

let native_options = eframe::NativeOptions {
        viewport: egui::ViewportBuilder::default()
            .with_inner_size(egui::vec2(800.0, 600.0))
            .with_resizable(true),
        ..Default::default()
    };

tarolling avatar Jul 27 '25 19:07 tarolling