Backport #19012

Fix infinite spin within fileclient