Skip to content

Fix deadlock in RPZ update code.

Witold Krecicki requested to merge 973-pause-dbiterator-in-rpz into master

In dns_rpz_update_from_db we call setup_update which creates the db iterator and calls dns_dbiterator_first. This unpauses the iterator and might cause db->tree_lock to be acquired. We then do isc_task_send(...) on an event to do quantum_update, which (correctly) after each iteration calls dns_dbiterator_pause, and re-isc_task_sends itself.

That's an obvious bug, as we're holding a lock over an async task send - if a task requesting write (e.g. prune_tree) is scheduled on the same workers queue as update_quantum but before it, it will wait for the write lock indefinitely, resulting in a deadlock.

To fix it we have to pause dbiterator in setup_update.

Closes #973 (closed)

Merge request reports