Skip to content

core: defer auth initialization until session lock is acquired - #1091

Merged
vaxerski merged 1 commit into
hyprwm:mainfrom
devpryan7792:fix/lock-acquisition-exit-hang
Nov 3, 2026
Merged

vaxerski merged 1 commit into
hyprwm:mainfrom
devpryan7792:fix/lock-acquisition-exit-hang

Conversation

@devpryan7792

Copy link
Copy Markdown
Contributor

Summary

Starting CAuth and initializing PAM / fingerprint threads before acquireSessionLock() causes secondary instances (or any instance launched while another lockscreen holds the session lock) to hang during exit when joining the PAM authentication thread, while pinning Wayland connections and preloaded texture/screencopy memory in RAM.

Changes

  1. Defer g_pAuth = makeUnique<CAuth>(); g_pAuth->start(); until after acquireSessionLock() succeeds.
  2. If session lock acquisition is rejected by the compositor, exit immediately without stranding background threads or allocating auth resources.
  3. Guard g_pAuth->terminate() with if (g_pAuth).
  4. In onLockFinished(), when !m_sLockState.locked, explicitly call m_sLockState.lock->sendDestroy() per the ext-session-lock-v1 specification.

Fixes #1075

Starting CAuth and spawning the PAM/fingerprint auth threads before
acquiring the session lock causes secondary hyprlock instances (or
instances launched while another lockscreen is active) to hang on exit
joining PAM threads or holding resources.

By deferring g_pAuth->start() until acquireSessionLock() succeeds, a
rejected instance exits immediately without stranding background threads
or pinning GPU/system memory. Also send destroy on lock object when
finished is received before locked per ext-session-lock-v1 spec.

Fixes hyprwm#1075
@vaxerski
vaxerski merged commit 73969a0 into hyprwm:main Nov 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

process hangs if existing holds session lock

2 participants