[bug fix] when buffer is full and flush failed, buffer would be full forever