Fix bug. Cachesend thread may sleep forever.