The only limit is memory. I've had eternal recursion dump after tens of thousands of iterations.
The solution depends on what you're trying to achieve. Any recursion should have an exit, where recursion stops. If what you're recursing on has a loop, then you need in some way to check if you've already processed the specific value. When I've been using recursion when dealing with HR hierarchical data, I've just found the dependency loop and reported it back to the HR administrators - they screwed up by putting a dependency loop into the hierarchy.