fix query cancellation test race condition