[top threads] Fixed infinite loop including DISTINCT to avoid duplicate messages.