add timeout for break from while.