Fix exit condition for RPC loop, fix test_status_api_failure test.

Reviewed at https://reviews.apache.org/r/26308/