[Okular-devel] [okular] [Bug 345684] Okular hangs after adding an annotation and choosing Save As

Daniel Vrátil dvratil at kde.org
Mon Apr 6 21:58:31 UTC 2015


https://bugs.kde.org/show_bug.cgi?id=345684

--- Comment #12 from Daniel Vrátil <dvratil at kde.org> ---
I did not write the code as Lukas suggested on IRC, but for what it's worth:

The cache and the semaphore are shared between multiple processes. When one
process acquires the semaphore (l. 287) and then gets blocked in
advancedDiskDetect() (l. 298) (due to some IO call blocking because of faulty
HW for example), then another process which tries to acquire the semaphore in
order to attach itself to the SHM (l. 257 and on) will block forever (however
Linux kernel should release the lock when the process which acquired it is
terminated).

I believe the only reason for the semaphore is to prevent multiple processes
calling advancedDiskDetect() at once during session start - so that only one
process does the call, others block and then access the cached data once the
first process writes them to SHM and releases the lock. I guess this
optimization could be sacrificed and only use QSharedMemory::(un)lock() to
synchronize access to the SHM. This would prevent applications from hanging
forever in case one process acquires the lock and then hangs for any reason,
but won't solve the problem when advancedDiskDetect() blocks on an IO call due
to faulty HW. The only solution to this is to execute advancedDiskDetect() in
thread and update the result asynchronously.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list