Residual stress and its role in failure