handle EAGAIN error