wasn't handling select() interrupts correctly