Backport #19012 to 2014.7

Backport #19012 

Fix infinite spin within fileclient