Skip to content

Fix deadlock when KConfigIni fails to acquire a file lock

Daniel Vrátil requested to merge work/dvratil/fix-deadlock-on-lock-fail into master

KConfigIniBackend::lock() locks a mutex, then attempts to acquire a lock file and returns whether acquiring the lock file was successful. However, if acquiring the lock file failed (e.g. due to a full disk), it would not unlock the mutex but would still return false, indicating a failure to acquire the lock to the caller. Thus, any subsequent call to KConfigIniBackend::lock() would deadlock on the locked mutex.

I was able to reliably reproduce this by running out of disk space and running any application (e.g. Plasma) that attempted to invoke KConfig::sync() multiple times.

Merge request reports