Fix rpc shutdown event condition bug