Looping forever over io in poll and selelct