Description
[REQUIRED] Please fill in the following fields:
- Unity editor version: 2018.4.24f1
- Firebase Unity SDK version: 6.16
- Source you installed the SDK: .unitypackage
- Problematic Firebase Component: Database
- Other Firebase Components in use: RemoteConfig, FCM,
- Additional SDKs you are using: Facebook
- Platform you are using the Unity editor on: Windows
- Platform you are targeting: desktop
- Scripting Runtime: Mono
[REQUIRED] Please describe the issue here:
Unity got crashed while using two unity editor logging same firebase project at the same time on single desktop. According to log, it is file access violation due to leveldb creation/removal.
unity_editor_crash.txt
The bug seems related to "persistent storage" which was introduced in 6.16. I am not sure which version of firebase-cpp-sdk is used by firebase-unity. But from firebase-cpp-sdk 6.16, it tries to create db from app_data_path.
https://github.com/firebase/firebase-cpp-sdk/blob/master/database/src/desktop/core/repo.cc#L477
From the crash log, you could find the path is C:\Users\maggie\AppData\Local\/rayark-soe-beta.firebaseio.com
.
After that, it tries to initialize levelDbPersistenceStorageEngine and also open DB. However, if the DB:Open fails, it calls After further investigation, it looks like the crash is caused by access violation and maybe triggered by firebase its own due to the log.assert(false)
which caused unity editor crash.
ERROR: Failed to initialize persistence storage engine at path C:\Users\victorchang\AppData\Local/rayark-soe-beta-chat.firebaseio.com: IO error: C:\Users\victorchang\AppData\Local/rayark-soe-beta-chat.firebaseio.com/LOCK: 程序無法存取檔案,因為檔案正由另一個程序使用。
ERROR: Could not initialize persistence
Crash!!!
SymInit: Symbol-SearchPath: 'C:/Program Files/Unity/Hub/Editor/2018.4.24f1/Editor/Data/Mono;.;D:\SOE\Client;C:\Program Files\Unity\Hub\Editor\2018.4.24f1\Editor;C:\WINDOWS;C:\WINDOWS\system32;SRVC:\websymbolshttp://msdl.microsoft.com/download/symbols;', symOptions: 534, UserName: 'victorchang'
OS-Version: 10.0.0
C:\Program Files\Unity\Hub\Editor\2018.4.24f1\Editor\Unity.exe:Unity.exe (0000000140000000), size: 79466496 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2018.4.24.29073
C:\WINDOWS\SYSTEM32\ntdll.dll:ntdll.dll (00007FFCDD8E0000), size: 2031616 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.18362.1171
C:\WINDOWS\System32\KERNEL32.DLL:KERNEL32.DLL (00007FFCDCA50000), size: 729088 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.18362.1110
BackendService: OnLogin: End
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(String, Object)
Rayark.SoulOfEden.UnityLogger:Rayark.SoulOfEden.ILogger.Log(String, Object) (at Assets\Scripts\Rayark\SoulOfEden\UnityLogger.cs:31)
Rayark.SoulOfEden.Backend.RayarkNet.<>c__DisplayClass57_01:<_TransformServiceErrors>b__1() (at Assets\Scripts\Rayark\SoulOfEden\Backend\RayarkNet\AllRayarkBackendService.cs:291) Rayark.<>c__DisplayClass2_0
1:b__0(None) (at Assets\Rayark\Scripts\Utility.cs:1094)
Rayark.Mast.d__9:MoveNext()
Rayark.Mast.Coroutine:_Resume()
Rayark.Mast.Coroutine:Resume(Single)
Rayark.Mast.Executor:Resume(Single)
Rayark.Mast.d__1:MoveNext()
Rayark.Mast.Coroutine:_Resume()
Rayark.Mast.Coroutine:Resume(Single)
Rayark.Mast.Executor:Resume(Single)
Rayark.SoulOfEden.Scenes.<_Loop>d__36:MoveNext() (at Assets\Scripts\Rayark\SoulOfEden\Scenes\SceneManager.cs:338)
Rayark.Mast.Coroutine:_Resume()
Rayark.Mast.Coroutine:Resume(Single)
Rayark.Mast.Executor:Resume(Single)
Rayark.Mast.d__12:MoveNext()
Rayark.Mast.Coroutine:_Resume()
Rayark.Mast.Coroutine:Resume(Single)
Rayark.SoulOfEden.ApplicationContextWrapper:Update() (at Assets\Scripts\Rayark\SoulOfEden\ApplicationContextWrapper.cs:232)
In my scenario, I have opened two unity editors with the same firebase project id. Hence, Db:Open
would always return failure due to DB has already been created by the former editor. Then, assert(false)
would be called causing unity crash.
Steps to reproduce:
Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
No
What's the issue repro rate?
100%
What happened?
Unity crash
How can we make the problem occur?
- Prepare two unity editors on same desktop
- Prepare two firebase account with same project id
- Set
Persistence Enable
true (default is true) - Get into play mode with both editors and login firebase. Then unity crashes.