No description
Find a file
Timo Strunk 53a8d0bea2 fix(kms): join surface threads before exit to avoid SIGABRT on shutdown
When the kiosk child exits, calling process::exit() directly from the calloop
callback runs libc's atexit handlers (Mesa's util_queue_kill_threads) while a
KMS surface thread may still be mid-frame in eglCreateSync(). Concurrent Mesa
teardown and live EGL use corrupt the heap and glibc aborts the process
("free(): corrupted unsorted chunks", SIGABRT).

Stop the event loop cleanly via should_stop instead, stashing the child's exit
code in Common::kiosk_exit_code. After the loop returns, pause() each DRM device
(releasing master so the surface drop path skips its blocking clear_state(), and
the incoming compositor gets master immediately), then drop_and_join() every
surface so no thread is left in Mesa. Only then is process::exit() called, at
which point atexit is safe to run.

The join is done here rather than in Surface::Drop because an unconditional join
in Drop deadlocks against apply_config_for_outputs during normal operation; once
the event loop has stopped, the surface thread can process ThreadCommand::End
and exit without the main thread servicing any pending message.

https://github.com/pop-os/cosmic-comp/issues/2375

Authored by Claude Opus 4.8
Reviewed by Timo Strunk <Timo.Strunk@gmail.com>

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 18:17:51 -06:00
.github ci: Make sure we lint and test all features 2026-03-24 16:23:43 +01:00
cosmic-comp-config feat: allow naming pinned workspaces 2026-06-15 23:11:31 +02:00
data feat(tiling-exceptions): add exception for Thunderbird message compose dialog 2026-06-11 09:23:38 -06:00
debian Use automatic shared library dependency on libdisplay-info 2025-10-21 08:50:17 -06:00
examples examples: Fix new libcosmic build 2026-07-09 18:08:01 +02:00
resources i18n: translation updates from weblate 2026-07-23 18:49:35 +02:00
src fix(kms): join surface threads before exit to avoid SIGABRT on shutdown 2026-07-23 18:17:51 -06:00
.gitignore Rework source filtering. 2023-01-04 01:52:16 -08:00
build.rs Revert "fix: use SOURCE_GIT_HASH when building for pop ci" 2026-06-15 12:16:32 -06:00
Cargo.lock chore(render): use Affine2 where possible 2026-07-21 15:53:38 +02:00
Cargo.toml chore(render): use Affine2 where possible 2026-07-21 15:53:38 +02:00
flake.lock Update and fix flake.nix 2024-09-02 19:44:51 +02:00
flake.nix fix: add missing libdisplay-info library into flake.nix 2025-01-12 13:09:03 +01:00
i18n.toml i18n support 2023-07-06 00:04:34 +02:00
LICENSE Initial commit 2021-12-15 17:25:15 +01:00
Makefile fix: add git hash to .cargo/config when vendoring 2026-06-15 12:16:32 -06:00
rust-toolchain.toml chore: theme-v2 libcosmic update 2026-07-09 18:08:01 +02:00
rustfmt.toml chore: format for Rust 2024 2025-10-22 23:55:11 +02:00