Cycle detection and escape using periodic checks.