Fix a newly-introduced deadlock in RelationCounterField.
Review Request #9633 — Created Feb. 12, 2018 and submitted — Latest diff uploaded
The recent fix for tracking multiple instances in
RelationCounterField
introduced a deadlock that manifested during a Review Board test suite
run. It was possible for a weak reference to drop while adding a new
instance, causing_reset_state
to grab a locl while_store_state
was
running (as part of the instantiation of anInstanceState
).We now delay setting up
InstanceState
until we leave the lock,
allowing the lock to just center around manipulating the state map, and
allowing setup/destroying to be in its own locks.
My reliably-broken unit test run no longer deadlocks.
All Djblets and Review Board unit tests pass.