address deadlock introduced in cd2469d3

(cherry picked from commit fd52417f)
70 jobs for !2743 with 1441-threadsanitizer-lock-order-inversion-potential-deadlock-usr-lib-x86_64-linux-gnu-libtsan-so-0-v9_14 in 25 minutes and 8 seconds (queued for 5 seconds)
merge request