MDL-24368 prevent infinite loops when caching can not be disabled