It is a typical problem mainly due to the fact that the heap is greater than the stack, and a heap-based recursive structure is deallocated with a nested (recursive) function call (the dtors, in your case).
A way to avoid this problem is delete the node iteratively, not by recursion.
class A
{
std::shared_ptr<A> next;
public:
~A()
{
while(next)
{
std::shared_ptr<A> killer;
std::swap(killer, next); std::swap(killer->next, next) } }
}