emilk / emilk/egui

SIGSEGV at exit of egui applications on hyprland + nvidia

Open
#3,962 6 comments 1 reaction 0 assignees View on GitHub
bug egui_glow native-linux
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Describe the bug**

All egui applications throw a `SIGSEGV` on application exit when running on hyprland + nvidia.
No issue when running in gnome 45.3 (wayland) + nvidia (on the same system).
No issue when on hyprland + amd or hyprland + intel.
I thought it might have been related to [#2952](https://github.com/emilk/egui/issues/2952) but turns out it's a different issue.

**To Reproduce**
Steps to reproduce the behavior:
1. `git clone https://github.com/emilk/egui.git /tmp/egui`
2. `cd /tmp/egui`
3. `RUST_LOG=debug cargo run -p hello_world`
4. close the application window
5. Error:

```
Process 51742 launched: '/tmp/egui/target/debug/hello_world' (x86_64)
[2024-02-04T16:32:26Z DEBUG eframe] Using the glow renderer
[2024-02-04T16:32:26Z DEBUG sctk] Bound new global [49] wl_output v4
[2024-02-04T16:32:26Z DEBUG sctk] Bound new global [48] zxdg_output_manager_v1 v3
[2024-02-04T16:32:26Z DEBUG sctk] Bound new global [14] wl_seat v7
[2024-02-04T16:32:26Z DEBUG sctk] Bound new global [39] wp_cursor_shape_manager_v1 v1
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Argb8888
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Xrgb8888
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Xbgr8888
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Abgr8888
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Bgr888
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Rgbx4444
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Rgba4444
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Rgbx5551
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Rgba5551
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Rgb565
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Xbgr16161616f
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Abgr16161616f
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Xbgr16161616
[2024-02-04T16:32:26Z DEBUG sctk] supported wl_shm format Abgr16161616
[2024-02-04T16:32:26Z DEBUG eframe::native::glow_integration] Event::Resumed
[2024-02-04T16:32:26Z 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-02-04T16:32:26Z DEBUG eframe::native::glow_integration] using the first config from config picker closure. config: Egl(Config { inner: Config { raw: EglConfig(0xcaf32c), display: Khr(0x555555fd61b0) } })
[2024-02-04T16:32:26Z DEBUG egui_winit] Failed to set window size
[2024-02-04T16:32:26Z DEBUG eframe::native::glow_integration] successfully created GL Display with version: EGL 1.5 and supported features: DisplayFeatures(CONTEXT_ROBUSTNESS | CONTEXT_NO_ERROR | SWAP_CONTROL | CREATE_ES_CONTEXT | MULTISAMPLING_PIXEL_FORMATS | SRGB_FRAMEBUFFERS)
[2024-02-04T16:32:26Z DEBUG eframe::native::glow_integration] creating gl context using raw window handle: Some(Wayland(WaylandWindowHandle { surface: 0x555555fd8a20 }))
[2024-02-04T16:32:27Z DEBUG eframe::native::glow_integration] Initializing egui_winit for viewport "FFFF"
[2024-02-04T16:32:27Z DEBUG eframe::native::glow_integration] Creating a gl_surface for viewport "FFFF"
[2024-02-04T16:32:27Z DEBUG sctk] Bound new global [14] wl_seat v7
[2024-02-04T16:32:27Z DEBUG egui_glow::painter]
opengl version: 3.3.0 NVIDIA 545.29.06
opengl renderer: NVIDIA GeForce RTX 3090/PCIe/SSE2
opengl vendor: NVIDIA Corporation
[2024-02-04T16:32:27Z DEBUG egui_glow::shader_version] Shader version: Gl140 ("3.30 NVIDIA via Cg compiler").
[2024-02-04T16:32:27Z DEBUG egui_glow::painter] Shader header: "#version 140\n".
[2024-02-04T16:32:27Z DEBUG egui_glow::painter] SRGB texture Support: true
[2024-02-04T16:32:27Z DEBUG egui_glow::vao] GL version: "3.3.0 NVIDIA 545.29.06".
[2024-02-04T16:32:28Z DEBUG eframe::native::glow_integration] Received WindowEvent::CloseRequested for viewport Some("FFFF")
[2024-02-04T16:32:28Z DEBUG eframe::native::epi_integration] Closing root viewport (ViewportCommand::CancelClose was not sent)
[2024-02-04T16:32:28Z DEBUG eframe::native::run] Asking to exit event loop…
[2024-02-04T16:32:28Z DEBUG eframe::native::run] Received Event::LoopExiting - saving app state…
[2024-02-04T16:32:28Z DEBUG eframe::native::run] eframe window closed
Process 51742 stopped
* thread #1, name = 'hello_world', stop reason = signal SIGSEGV: invalid address (fault address: 0xe4)
frame #0: 0x00007ffff7fb5415 libwayland-client.so.0`___lldb_unnamed_symbol150 + 69
libwayland-client.so.0`___lldb_unnamed_symbol150:
-> 0x7ffff7fb5415 <+69>: movq %rcx, (%rax,%rbx,8)
0x7ffff7fb5419 <+73>: xorl %eax, %eax
0x7ffff7fb541b <+75>: addq $0x10, %rsp
0x7ffff7fb541f <+79>: popq %rbx
```

**Expected behavior**
No seg fault.

**Screenshots**
N/A

**Desktop (please complete the following information):**
- OS: Arch Linux
- Linux: 6.7.3
- Hyprland: 0.34.0
- Nvidia driver: 545.29.06
- egui Version: 0.25 and MASTER

**Additional context**
As mentionned above, no SEGFAULT on Gnome 45.3 running on wayland with `kms-modifiers`. Nvidia config in `hyprland.conf`:

```
env = LIBVA_DRIVER_NAME,nvidia
env = NVD_BACKEND,direct
env = GBM_BACKEND,nvidia-drm
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
env = __GL_GSYNC_ALLOWED,1
env = WLR_NO_HARDWARE_CURSORS,1
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the crash with `RUST_LOG=debug cargo run -p hello_world` on the reported Hyprland and NVIDIA setup, then inspect the eframe native glow integration shutdown path around `WindowEvent::CloseRequested`, `Event::LoopExiting`, and the `eframe window closed` log. Done means closing the hello_world window exits cleanly without a SIGSEGV.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.