AccessViolation on OpenLevel dedicated server due to InstancedStaticMesh

finyeates
Fri, 23 Oct 2020 19:34:29 +0000
Getting Started & Setup

We’re currently running into a very odd, and hard to reproduce issue.

We have a 2x2km map with a number of different speed tree instanced foliage meshes, in which we have a transition mechanic which essentially just calls an ‘open level’ node which takes the player from one dedicated server to another. In a shipping build, we see about a 70-80% crash rate going from the overworld map to these dungeon instances, but 0% going back the other way.

The error we’re getting originates in:

InstancedStaticMesh.h:

 void ReleaseResources(FSceneInterface* Scene, const UStaticMesh* StaticMesh)
 ...
	// unregister SpeedTree wind with the scene
	if (Scene && StaticMesh && StaticMesh->SpeedTreeWind.IsValid()) {
		for (int32 LODIndex = 0; LODIndex < VertexFactories.Num(); LODIndex++)
		{
			Scene->RemoveSpeedTreeWind_RenderThread(&VertexFactories[LODIndex], StaticMesh);
		}
	}

At the point of calling this code the StaticMesh has already been destroyed and the code trips an access violation when accessing the SpeedTreeWind member.

Attaching to a process in VS17 reduces the rate of this issue significantly - down to ~5-10% of the time, making it significantly hard to pin down. We can’t see any correlation between the issue occurring and hardware, so we’re thinking it might be something more akin to a race-condition in the cleanup when transitioning between two dedicated server maps with speedtree foliage.

We’re at a bit of a loss after investigating this issue now for a few days and getting nowhere - has anyone seen anything similar or can provide some ideas as to what we can look into next.

1 post - 1 participant