[4.8.1] Audio crash after C++ hot-reload

I did another test and it revealed something interesting!

Sounds and sound device handles looks like this after a hot-compile

50526-workingscenario.png

and sounds work without a problem (I tested playing sound cues from within the sound-cue editor, and it worked!), but as soon as I PIE after the hot-compile the sound breaks.

I left the game without playing a sound and then returned to the sound-cue editor and when I try to play a sound from there. Nothing. Not a sound plays. Probably because the sound-cue editor checks if there’s a valid sound device before trying to play a sound.

So there’s something that breaks, not right after a hot-compile, but rather after initializing a PIE session after a hot-compile!

~Per “” Johansson

Are you running the editor by itself or are you running in debug mode through Visual Studio? Also are you hot reloading by compiling the VS solution with the editor open or are you using the compile button inside the editor? What code are you changing to trigger the hot reload? Does the crash happen when you first start PIE because of the background music or does it only occur after you try to fire and the guy sound plays? I’ve tried adding a variable to the Projectile.cpp file and compiling through both the editor and Visual Studio but have not crash on PIE after a hot reload.

  • I’m running the editor through Visual
    Studios debug mode
  • Compile button in the editor
  • I only press space and then backspace to really don’t change anything, just to trigger the hot-recompile.
  • The background music plays, but as soon as I fire or play any other SFX it crashes

~Per “” Johansson

Hey -

I’m still trying to use your project to reproduce the crash on my machine. I was trying to use the editor by itself and now I’m trying through Visual Studio. Since you’re able to reproduce this easily could you reproduce the crash without running through Visual Studio debug and then send the resulting callstack and the log files from the editor session?

Cheers

I started it without the VS debugger now and crashed as usual after the hot-compile. I don’t know how to get a hold on the callstack when I don’t use the debugger but I attached the log file at least.

~Per “” Johansson

The callstack is in the bottom portion of the black Crash Report Window that pops up after the crash occurs.

This is what I get in the crash reporter

~Per “” Johansson

I’ve been keeping a close eye on the unreal engine repository in search for a fix for this issue, and I stumbled upon this commit: https://github.com/EpicGames/UnrealEngine/commit/57b0005379fdd866d0019c179dd8a695ae493ae8

Could this be the solution which I’ve been waiting for? If so, thank you!

~Per “” Johansson

Hey -

I wanted to touch base with you and let you know that I am still investigating this crash. Using the project you sent I have tried to run it in debug mode and PIE, added a float value to Weapon.h and then hot reload through the editor, and then PIE again. Let me know if this is enough to cause the crash on your end or if there is something I’m missing.

Cheers

Yup, I’m sorry to say that on my end there’s nothing more to it.

I’m in the process of creating a clone of the project to see if there’s only something wrong with the local copy. I’ll get back to you with the result.

~Per “” Johansson

for what it’s worth, for me I don’t even need to add a variable. If i even change something in the body of some preexisting method and compile for hot-reload, it will crash.

Let’s try another angle, what version of VS are you using to compile?

I’m currently VS Ultimate 2013. 12.0.21005.1 REL
.NET 4.5.51641

i’m downloading VS2013 patch 5 right now to just see i guess.

Mine is

Microsoft Visual Studio Ultimate 2013, Version 12.0.30501.00 Update 2
NET Version 4.5.51209

~Per “” Johansson

I re-downloaded a clean copy from our repository and got the same result as usual. So I’m guessing there’s something with the combination of how the project is built and that the engine version is 4.8.

~Per “” Johansson

I get the same issue even with the ShooterGame demo by itself. After a hot reload and playing in a new window, the environment sounds start playing, but then it crashes where presumably it plays the respawn sound through PlaySoundAtLocation().

So it seems very likely that this is system specific. My VS version is 12.0.31101.00 Update 4 NET Version 4.5.51641 and I’m on Windows 8.1.

Hmmmm. maybe some kind of sound driver/DirectSound(?) issue, since it’s all crashing in sound code for us?
I’m using onboard audio, Lists as “Envy24 Family Audio Controller”
driver 6.3.9600.16384

I downloaded the 4.10.0-0+UE4 version of Unreal Engine from the official git repository and I’m happy to tell you that the master branch version didn’t cause the project to crash after a hot-reload and a PIE session!

I’ll promote this comment to an answer if you all think that is a good enough of a reason, since this isn’t really a solution other than waiting for the next stable update.

~Per “” Johansson

Hey guys – sorry to get in on this question so late!!! Yeah, this is an issue I think we discovered a while ago and it was likely simply due to variable shadowing and I believe was fixed in CL 2532216.

https://github.com/EpicGames/UnrealEngine/commit/a3443c81d5f0a39d8c4bde11b445a67873f1c275

Wait what does this mean? so no pub fix for 4.8 version time frame?

Yeah I’m wondering about that too, will there be a 4.8.3 hotfix version containing this solution? Or will we have to wait for 4.9?

~Per “” Johansson

I have also been experiencing this exact problem. I tried applying CL 2532216 on top of 4.8 and the issue still wasn’t fixed.