Crash when levels containing speedtrees get streamed out

Hi,

We’ve setup our level using the world composition system. As we move around levels get loaded and unloaded. If a level that has a speed tree in it is unloaded we get a crash on the render thread in FScene::UpdateSpeedTreeWind.

The problem seems to be that a UStaticMesh can be GC’ed before the UStaticMeshComponents that use it are GC’ed. Because the speed tree wind data is only cleaned up by the UStaticMeshComponent::OnUnregister, if the UStaticMesh is GC’ed before the component it seems possible that the render thread can wake up and try to update the speed tree wind data that is now referenced by a dead UStaticMesh pointer.

I’ve currently fixed this by putting an instances of each of our speed trees under the ground in our persistent level, so that the UStaticMesh object never gets GC’ed.

Regards,

Ryan.

Hi Ryan,

I’ve tried to reproduce this but have not been able to to get a crash with this. In my test setup everything loads and unloads properly for the levels.

Here is my setup. Let me know if I’m missing something or not doing it the same and I’ll adjust to your method and see if I can get the same issue.

  • I have a persistent level and 2 sub levels (Level 1 and Level 2)
  • In my Persistent I only have a platform for my guy to stand on
  • Level 1 is loading in floor and nothing else
  • Level 2 is loading in the SpeedTree asset (Used the broadleaf desktop from the free SpeedTree sample pack)
  • I have the Level BP set on start to load in Level 1, then unload after 5 seconds, load in Level 2, then unload after 5 seconds, and repeat this process a couple of times.
  • I also have the load and unload level tied to a key press toggle for loading an unloading each level independently.

This is the gist of my setup. Is this how you’ve set yours up as well?

Thanks!

Tim

If you only have one speed tree placed then it shouldn’t cause a crash. You’ll need to put lots of speed tree instances down so that there’s lots of UStaticMeshComponents in the level for the one UStaticMesh object. If the UStaticMesh gets garbage collected before the UStaticMeshComponent and the render thread tries to render them, then it should crash.

Also, the speed tree needs to have wind data associated with it. Make sure your trees a animating with the wind :slight_smile:

So for the crash to trigger it will be a combination of garbage collection happening post stream out and it randomly GC’ing the UStaticMesh before any of the UStaticMeshComponents and the render thread trying to update the speed tree wind data before the rest of the UStaticMeshComponents being GC’ed.

Hi Ryan,

I’ve gone back and tried this again still with no crash. I’ve used my level streaming test scene and placed ~1500 SpeetTrees along with testing with and without the directional wind source to add the effect to my trees.

Are you able to make a small test project as an example that crashes. I would like to test on my end and see if there is a repro for this.

Since I’m not able to get a crash (at the moment with this) can you attach your crash logs and dmp (Your project folder > Saved > Logs) and a copy of your call stack from crash reporter in a text file?

Thanks!

Tim

Hi Tim,

I’ve attached the crash stack, dump file and log file. The stack was to big for a comment so I had to put it in a file.

Also, I noticed when I reproduced the crash to get the crash stack that I had to run the game standalone. i.e. UE4Editor.exe submerged -game -log

Running the game in the editor window didn’t reproduce the crash. Something else to try with your test level.

Regards,

Ryan.

link text

Hi Ryan,

Thanks for that tip! I’m trying to nail down an exact repro. While I was able to get the crash in a previous project I had already setup level streaming with. When I just tried to re-test in a completely new project I’m not getting the crash. I’m trying to figure out where I’ve missed a step or if something else is going on. I need to get a clear repro and make sure all my steps are in line to get a good bug report submitted so the developer can repro themselves.

Thank you for the logs. I’ll update you once I’ve got this finalized and submitted.

Tim

Great! Thanks, Tim.

Hi Ryan,

Apologies for the delayed response here. The JIRA for this issue is UE-7977.

I’ll update this post once a fix has been submitted and verified.

Thank you!

Tim

Any change on this? This is a crucial fix that our team requires in order to release our game around April.

The target fix is 4.8, but this is not definitive at the moment until a fix has been submitted. When a fix has been submitted I will be sure to update the post here.

Thank you!

Tim

I’m having the same issue I think every odd new game or load game open map persistent_base world composed project crashes package but not the editor play or PIE?

need to find a fix.