# AccessViolation on OpenLevel dedicated server due to InstancedStaticMesh

**URL:** <https://forums.unrealengine.com/t/accessviolation-on-openlevel-dedicated-server-due-to-instancedstaticmesh/473387>\
**Category:** Getting Started & Setup\
**Tags:** dedicated-server, access-violation, open-level, unreal-engine, Instanced-Mesh, crash, question\
**Created:** [October 23, 2020, 7:34pm UTC](https://forums.unrealengine.com/t/accessviolation-on-openlevel-dedicated-server-due-to-instancedstaticmesh/473387 "2020-10-23T19:34:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![finyeates](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@finyeates](https://forums.unrealengine.com/u/finyeates)\
**Post date:** [October 23, 2020, 7:34pm UTC](https://forums.unrealengine.com/t/accessviolation-on-openlevel-dedicated-server-due-to-instancedstaticmesh/473387/1 "2020-10-23T19:34:29Z")

</div>

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.
