YARN-2010. Handle app-recovery failures gracefully. (Jian He and Karthik Kambatla via kasha)

(cherry picked from commit b2cd2698028118b6384904732dbf94942f644732)