A stack overflow is an error that user-mode threads can encounter. There are three possible causes for this error:
A thread uses the entire stack reserved for it. This is often caused by infinite recursion.
A thread cannot extend the stack because the page file is maxed out, and therefore no additional pages can be committed to extend the stack.
A thread cannot extend the stack because the system is within the brief period used to extend the page file.