Fix client timeout issues

Fixes issues #7157, #9302.
Probably #8845, #6064 and others too.