Astar crash in editor and builds

Unity v2021.3.9f1 - BIRP
astar v4.2.17
Windows 10 pro 64bit

Just starting to get crashes in both the editor and builds.
The crashes immediately shutdown both, there is no crash window.
The player log does capture an exception, which looks like it starts here:

It goes on to repeat the FlipEdgeEvent and FlipScanEdgeEvent entries about a million times.

Path Completed : Computation Time 0.00 ms Searched Nodes 6 Path Length 2
Path Number 1264 (unique id)
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
AstarPath:LogPathResults (Pathfinding.Path) (at D:/__UnityProjects/SOI_2020.3.8f1_LTS_v2021/SOI_2020.3.8f1_LTS_v2021/Assets/AstarPathfindingProject/Core/AstarPath.cs:837)
AstarPath:<InitializePathProcessor>b__122_1 (Pathfinding.Path) (at D:/__UnityProjects/SOI_2020.3.8f1_LTS_v2021/SOI_2020.3.8f1_LTS_v2021/Assets/AstarPathfindingProject/Core/AstarPath.cs:1301)
Pathfinding.PathProcessor:CalculatePathsThreaded (Pathfinding.PathHandler) (at D:/__UnityProjects/SOI_2020.3.8f1_LTS_v2021/SOI_2020.3.8f1_LTS_v2021/Assets/AstarPathfindingProject/Core/Misc/PathProcessor.cs:379)
Pathfinding.PathProcessor/<>c__DisplayClass24_0:<.ctor>b__0 () (at D:/__UnityProjects/SOI_2020.3.8f1_LTS_v2021/SOI_2020.3.8f1_LTS_v2021/Assets/AstarPathfindingProject/Core/Misc/PathProcessor.cs:110)
System.Threading.ThreadHelper:ThreadStart_Context (object)
System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object)
System.Threading.ThreadHelper:ThreadStart ()

(Filename: D:/__UnityProjects/SOI_2020.3.8f1_LTS_v2021/SOI_2020.3.8f1_LTS_v2021/Assets/AstarPathfindingProject/Core/AstarPath.cs Line: 837)

PointOnEdgeException, perturbating vertices slightly.
This is usually fine. It happens sometimes because of rounding errors. Cutting will be retried a few more times.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogWarning (object)
Pathfinding.Util.TileHandler:CutPoly (Pathfinding.Int3[],int[],Pathfinding.Int3[],Pathfinding.Util.GraphTransform,Pathfinding.IntRect,Pathfinding.Util.TileHandler/CutMode,int) (at D:/__UnityProjects/SOI_2020.3.8f1_LTS_v2021/SOI_2020.3.8f1_LTS_v2021/Assets/AstarPathfindingProject/Generators/Utilities/TileHandler.cs:680)
Pathfinding.Util.TileHandler/<>c__DisplayClass41_0:<LoadTile>b__0 (Pathfinding.IWorkItemContext,bool) (at D:/__UnityProjects/SOI_2020.3.8f1_LTS_v2021/SOI_2020.3.8f1_LTS_v2021/Assets/AstarPathfindingProject/Generators/Utilities/TileHandler.cs:1154)
Pathfinding.WorkItemProcessor:ProcessWorkItems (bool) (at D:/__UnityProjects/SOI_2020.3.8f1_LTS_v2021/SOI_2020.3.8f1_LTS_v2021/Assets/AstarPathfindingProject/Core/Misc/WorkItemProcessor.cs:300)
AstarPath:PerformBlockingActions (bool) (at D:/__UnityProjects/SOI_2020.3.8f1_LTS_v2021/SOI_2020.3.8f1_LTS_v2021/Assets/AstarPathfindingProject/Core/AstarPath.cs:881)
AstarPath:Update () (at D:/__UnityProjects/SOI_2020.3.8f1_LTS_v2021/SOI_2020.3.8f1_LTS_v2021/Assets/AstarPathfindingProject/Core/AstarPath.cs:864)

(Filename: D:/__UnityProjects/SOI_2020.3.8f1_LTS_v2021/SOI_2020.3.8f1_LTS_v2021/Assets/AstarPathfindingProject/Generators/Utilities/TileHandler.cs Line: 680)

StackOverflowException: The requested operation caused a stack overflow.
  at Pathfinding.Poly2Tri.FixedArray3`1[T].IndexOf (T value) [0x00007] in <07aca9e84ffe412bbfb50d0962eb64f2>:0 
  at Pathfinding.Poly2Tri.DelaunayTriangle.IndexOf (Pathfinding.Poly2Tri.TriangulationPoint p) [0x00000] in <07aca9e84ffe412bbfb50d0962eb64f2>:0 
  at Pathfinding.Poly2Tri.DelaunayTriangle.PointCWFrom (Pathfinding.Poly2Tri.TriangulationPoint point) [0x00000] in <07aca9e84ffe412bbfb50d0962eb64f2>:0 
  at Pathfinding.Poly2Tri.DelaunayTriangle.OppositePoint (Pathfinding.Poly2Tri.DelaunayTriangle t, Pathfinding.Poly2Tri.TriangulationPoint p) [0x00000] in <07aca9e84ffe412bbfb50d0962eb64f2>:0 
  at Pathfinding.Poly2Tri.DTSweep.FlipScanEdgeEvent (Pathfinding.Poly2Tri.DTSweepContext tcx, Pathfinding.Poly2Tri.TriangulationPoint ep, Pathfinding.Poly2Tri.TriangulationPoint eq, Pathfinding.Poly2Tri.DelaunayTriangle flipTriangle, Pathfinding.Poly2Tri.DelaunayTriangle t, Pathfinding.Poly2Tri.TriangulationPoint p) [0x0000a] in <07aca9e84ffe412bbfb50d0962eb64f2>:0 
  at Pathfinding.Poly2Tri.DTSweep.FlipEdgeEvent (Pathfinding.Poly2Tri.DTSweepContext tcx, Pathfinding.Poly2Tri.TriangulationPoint ep, Pathfinding.Poly2Tri.TriangulationPoint eq, Pathfinding.Poly2Tri.DelaunayTriangle t, Pathfinding.Poly2Tri.TriangulationPoint p) [0x00115] in <07aca9e84ffe412bbfb50d0962eb64f2>:0 
  at Pathfinding.Poly2Tri.DTSweep.FlipScanEdgeEvent (Pathfinding.Poly2Tri.DTSweepContext tcx, Pathfinding.Poly2Tri.TriangulationPoint ep, Pathfinding.Poly2Tri.TriangulationPoint eq, Pathfinding.Poly2Tri.DelaunayTriangle flipTriangle, Pathfinding.Poly2Tri.DelaunayTriangle t, Pathfinding.Poly2Tri.TriangulationPoint p) [0x00066] in <07aca9e84ffe412bbfb50d0962eb64f2>:0 

Hi

This is a bug in a third party library I’m using. Sadly, I don’t have a great solution at the moment, but this is usually caused by navmesh cuts that are either setup incorrectly, or have overlapping vertices/edges. Do you think that might be the case for your scene?

Yes kind of like the navmeshcut demo scene where you drop tons of individual blocks, I have scenarios where I have a bunch of logs that can end up in a pile and each log has navmeshcut. For now I’ve turned navmeshcut off which isn’t ideal.

Is there no way to at least catch the error? I’d rather have navmeshcut fail on the offending object and just not get cut than have a known game closing crash left in.

Speaking of the demo does the error never happen there? It seems to be the same scenario.

Not the stackoverflow one, sadly. That one cannot be caught. Though I’ve never personally seen that happen on my machine, so it must be a very specific setup. Are the blocks in random positions or are they positioned in a very structured way?

They were just big piles of logs that all spawn in the same location. I don’t see how it’s much different from the astar demo where you can spam tons of cubes that have navmeshcut on them, apart from I spawned in 10 logs at a time at the same transform (it was only a test). If all it takes is two edge overlapping then it’s just a matter of time before it crashes. So I’m a bit terrified of using navmeshcut because that error is possible.

Perhaps there can be a recursive limit put in place? Like 10 or 100 times then it just fails the cut. Failing a single (or even a few) navmesh cuts isn’t critical, at least not in my game.

Sadly, this recursion is inside a third party library that I don’t have control over :frowning:
But yeah, generally things like this happens if there are many edges/vertices at the exact same position. The library doesn’t handle that well. I have workarounds to make it possible to handle that in almost all cases, but it’s not 100%, unfortunately. I’m strongly considering just rewriting that library…