Unity Editor crash inside FMOD_File_GetDiskBusy()

I just spent an annoying morning tracking down why the Unity Editor was crashing whenever I hit play, and thought I’d post here to save everyone else some pain.

The Unity Editor would crash when entering play mode. It initially looked like fmod was crashing during initialisation (Callstack below).
Rebooting the computer would allow the game to play ONCE, and then we’d be back to crashing every time.

With a bit of blind luck I eventually I tracked it down to adb.exe (part of the android SDK) holding files open. Note all this was in a Windows standalone project, nothing to do with Android at all, although I had recently installed the android SDK to work on another unrelated Unity project.

There is a forum thread discussing a Unity bug that causes problems with adb.exe that all sounded very familiar. Sure enough killing adb.exe allowed my game to play and fmod to initialise correctly, but again Unity ran adb.exe when entering playmode and attempting to enter playmode a second time without killing adb.exe would result in an editor crash.

As a work around for now I have disabled the Android SDK in Unity (delete the registery key AndroidSdkRoot from HKEY_CURRENT_USER\Software\Unity Technologies\Unity Editor 4.x) and everything is working. Hopefully Unity fix the underlying bug soon.

Crash CallStack:

(0x615A5D13) (fmodstudio): (filename not available): FMOD_File_GetDiskBusy + 0xf0cb3
(0x615E6845) (fmodstudio): (filename not available): FMOD_File_GetDiskBusy + 0x1317e5
(0x6161D5EE) (fmodstudio): (filename not available): FMOD_File_GetDiskBusy + 0x16858e
(0x6162CA38) (fmodstudio): (filename not available): FMOD_Studio_System_Initialize + 0x28
(0x17A2CDAD) (Mono JIT code): (filename not available):  (wrapper managed-to-native) FMOD.Studio.System:FMOD_Studio_System_Initialize (intptr,int,FMOD.Studio.INITFLAGS,FMOD.INITFLAGS,intptr) + 0x8d (17A2CD20 17A2CE0F) [09546D20 - Unity Child Domain] + 0x0
(0x17A2CD03) (Mono JIT code): (filename not available):  FMOD.Studio.System:init (int,FMOD.Studio.INITFLAGS,FMOD.INITFLAGS,intptr) + 0x43 (17A2CCC0 17A2CD0E) [09546D20 - Unity Child Domain] + 0x0
(0x17A2A53A) (Mono JIT code): (filename not available):  FMOD_StudioSystem:Init () + 0x1fa (17A2A340 17A2A586) [09546D20 - Unity Child Domain] + 0x0
(0x17A298E5) (Mono JIT code): (filename not available):  FMOD_StudioSystem:get_instance () + 0xe5 (17A29800 17A29903) [09546D20 - Unity Child Domain] + 0x0
(0x17A2965D) (Mono JIT code): (filename not available):  InvadersSystem:Awake () + 0x1d (17A29640 17A297A7) [09546D20 - Unity Child Domain] + 0x0
(0x0D2DBE1F) (Mono JIT code): (filename not available):  (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) + 0x8f (0D2DBD90 0D2DBEEA) [09546D20 - Unity Child Domain] + 0x0
(0x09F3FEDE) c:\buildslave\monoandruntimeclasslibs\build\mono\mini\mini.c (4889 + 0xc): mono_jit_runtime_invoke + 0x214
(0x09EAD680) c:\buildslave\monoandruntimeclasslibs\build\mono\metadata\object.c (2618 + 0x10): mono_runtime_invoke + 0x51
(0x00706EF8) c:\buildagent\work\d3d49558e4d408f4\runtime\scripting\backend\mono\scriptingbackendapi_mono.cpp (183 + 0x1a): scripting_method_invoke + 0xb8
(0x00826C78) c:\buildagent\work\d3d49558e4d408f4\runtime\scripting\backend\scriptinginvocation.cpp (115 + 0x0): ScriptingInvocation::Invoke + 0x58
(0x0082716E) c:\buildagent\work\d3d49558e4d408f4\runtime\scripting\backend\scriptinginvocation.cpp (99 + 0x0): ScriptingInvocation::Invoke + 0xe
(0x008271DC) c:\buildagent\work\d3d49558e4d408f4\runtime\scripting\backend\scriptinginvocationnoargs.cpp (120 + 0x13): ScriptingInvocationNoArgs::InvokeChecked + 0x2c
(0x006F2300) c:\buildagent\work\d3d49558e4d408f4\runtime\mono\monobehaviour.cpp (347 + 0x0): MonoBehaviour::CallMethodInactive + 0xa0
(0x006F250A) c:\buildagent\work\d3d49558e4d408f4\runtime\mono\monobehaviour.cpp (1393 + 0x6): MonoBehaviour::CallAwake + 0x1a
(0x006F5B2D) c:\buildagent\work\d3d49558e4d408f4\runtime\mono\monobehaviour.cpp (1355 + 0xb): MonoBehaviour::AwakeFromLoad + 0x7d
(0x0087752A) c:\buildagent\work\d3d49558e4d408f4\runtime\serialize\awakefromloadqueue.cpp (327 + 0x0): AwakeFromLoadQueue::InvokePersistentManagerAwake + 0xba
(0x00877B0B) c:\buildagent\work\d3d49558e4d408f4\runtime\serialize\awakefromloadqueue.cpp (160 + 0x6b): AwakeFromLoadQueue::PersistentManagerAwakeFromLoad + 0x7b
(0x0087C3C7) c:\buildagent\work\d3d49558e4d408f4\runtime\serialize\persistentmanager.cpp (1006 + 0x0): PersistentManager::IntegrateAllThreadedObjectsStep2 + 0x47
(0x0081A1B1) c:\buildagent\work\d3d49558e4d408f4\runtime\misc\saveandloadhelper.cpp (808 + 0x34): CompletePreloadManagerLoadLevelEditor + 0x81
(0x007DF407) c:\buildagent\work\d3d49558e4d408f4\runtime\misc\preloadmanager.cpp (790 + 0x18): PreloadLevelOperation::IntegrateMainThread + 0x147
(0x007E0F04) c:\buildagent\work\d3d49558e4d408f4\runtime\misc\preloadmanager.cpp (471 + 0x0): PreloadManager::UpdatePreloadingSingleStep + 0x134
(0x007E1160) c:\buildagent\work\d3d49558e4d408f4\runtime\misc\preloadmanager.cpp (534 + 0x0): PreloadManager::WaitForAllAsyncOperationsToComplete + 0x50
(0x0081D238) c:\buildagent\work\d3d49558e4d408f4\runtime\misc\saveandloadhelper.cpp (848 + 0x0): LoadSceneEditor + 0x128
(0x00F67D5A) c:\buildagent\work\d3d49558e4d408f4\editor\src\application.cpp (1558 + 0xe): Application::LoadSceneInternal + 0x8a
(0x00F68FA3) c:\buildagent\work\d3d49558e4d408f4\editor\src\application.cpp (2464 + 0x27): Application::SetIsPlaying + 0x323
(0x00F6EBED) c:\buildagent\work\d3d49558e4d408f4\editor\src\application.cpp (1363 + 0x0): Application::TickTimer + 0x74d
(0x0100C682) c:\buildagent\work\d3d49558e4d408f4\editor\platform\windows\wineditormain.cpp (336 + 0x0): MainMessageLoop + 0x1c2
(0x0100D5C7) c:\buildagent\work\d3d49558e4d408f4\editor\platform\windows\wineditormain.cpp (848 + 0x0): WinMain + 0xe37
(0x01125C34) f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (275 + 0x1c): __tmainCRTStartup + 0x11a
(0x75A2336A) (kernel32): (filename not available): BaseThreadInitThunk + 0x12
(0x77B29F72) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x63
(0x77B29F45) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x36