race in connect with error case