BROOKLYN-66: fix deadlock (and various others)