It generally occurs when a thread's stack becomes exhausted, commonly due to excessive or infinite recursion.