Handle possible infinite loop via gtimeout