Skip to content

kerberos-identity: Ensure idles queued to main thread are property synchronized

Ray Strode requested to merge fix-dropped-notify into master

Kerberos identities are refreshed on a helper thread, and the state of those identities are exported over the user bus on the main thread.

Since the main consumer of an identity's properties is the bus service running on the main thread, to simplify things, property notifications are dispatched from the main thread as well (even though the underlying state is changed on a worker thread).

The mechanism to dispatch property notifies to the main thread is an idle handler. The logic for doing the dispatch has a concurrency bug however. In order to coaelsce multiple notifies that happen in quick succession, the dispatch code checks for a preexisting idle id associated with the given property. That idle id is set from the worker thread when the idle is queued, and it's cleared from the main thread when the idle is dispatched. The bug is that the main thread could in theory clear the idle id immediately after the worker thread decided there was already a notify queued, leading to a notify getting completely dropped.

This commit addresses the bug by adding appropriate locking.

Closes #160 (closed)

Merge request reports