address deadlock introduced in cd2469d3

(cherry picked from commit fd52417f)
66 jobs for !2746 with 1441-threadsanitizer-lock-order-inversion-potential-deadlock-usr-lib-x86_64-linux-gnu-libtsan-so-0-v9_11 in 23 minutes and 51 seconds (queued for 6 seconds)
merge request