Support Forum

Beta, LayeredGridGraph, StackOverflowException

Hello.
There is a Stack Overflow exception when looking for longer paths on LayeredGridGraph on Beta version:

StackOverflowException: The requested operation caused a stack overflow.
Pathfinding.BinaryHeap.DecreaseKey (Pathfinding.BinaryHeap+Tuple node, System.UInt16 index) (at Library/PackageCache/com.arongranberg.astar@4.3.38/Core/Misc/BinaryHeap.cs:156)
Pathfinding.BinaryHeap.Add (Pathfinding.PathNode node) (at Library/PackageCache/com.arongranberg.astar@4.3.38/Core/Misc/BinaryHeap.cs:137)
Pathfinding.LevelGridNode.UpdateRecursiveG (Pathfinding.Path path, Pathfinding.PathNode pathNode, Pathfinding.PathHandler handler) (at Library/PackageCache/com.arongranberg.astar@4.3.38/Generators/LayerGridGraphGenerator.cs:1041)
Pathfinding.LevelGridNode.UpdateRecursiveG (Pathfinding.Path path, Pathfinding.PathNode pathNode, Pathfinding.PathHandler handler) (at Library/PackageCache/com.arongranberg.astar@4.3.38/Generators/LayerGridGraphGenerator.cs:1056)
Pathfinding.LevelGridNode.UpdateRecursiveG (Pathfinding.Path path, Pathfinding.PathNode pathNode, Pathfinding.PathHandler handler) (at Library/PackageCache/com.arongranberg.astar@4.3.38/Generators/LayerGridGraphGenerator.cs:1056)

[...]

Pathfinding.LevelGridNode.UpdateRecursiveG (Pathfinding.Path path, Pathfinding.PathNode pathNode, Pathfinding.PathHandler handler) (at Library/PackageCache/com.arongranberg.astar@4.3.38/Generators/LayerGridGraphGenerator.cs:1056)
Pathfinding.LevelGridNode.UpdateRecursiveG<message truncated>
Unhandled exception during pathfinding. Terminating.
UnityEngine.Debug:LogError(Object)
Pathfinding.PathProcessor:CalculatePathsThreaded(PathHandler) (at Library/PackageCache/com.arongranberg.astar@4.3.38/Core/Misc/PathProcessor.cs:541)
Pathfinding.<>c__DisplayClass26_0:<.ctor>b__0() (at Library/PackageCache/com.arongranberg.astar@4.3.38/Core/Misc/PathProcessor.cs:147)
System.Threading.ThreadHelper:ThreadStart()

Preview: https://www.youtube.com/watch?v=r9XyJmD5Fo4

LayeredGridGraph settings:

It happens on one thread and multithreading.

Hi

Are you using e.g. a ITraversalProvider or doing anything else non-standard with paths?

Unfortunately not. I haven’t change anything to a grid.
I only call Pathfinding.Seeker.StartPath directly from the poll of Seekers components that I have made (I have different Seekers for animals, different for humans etc.). That’s only difference.

Are you setting any penalties or anything else in the graph?
Does this happen if you make your graph smaller?

No, clear graph, just placed.
Yes, after changing grid size / grid node size there is no exception, but this is not a “solution” :wink:

I can unfortunately not replicate this issue :frowning: