firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
216 stars 35 forks source link

[Bug] Crash during Run or Stop Unity editor #561

Closed Maskusa closed 1 year ago

Maskusa commented 1 year ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

While working in the Uniny editor, Unity crashes randomly when starting or stopping a project. Events happen very often.

firebase_unity_sdk_10.1.1 Log and Dump: https://drive.google.com/drive/folders/1Ucz_9nZPJzF-BRdTjwauyEV_nxInDZ-u?usp=sharing

========== OUTPUTTING STACK TRACE ==================

0x00007FFCC34D1219 (FirebaseCppApp-10_1_1) uWS::HttpSocket<0>::upgrade
0x00007FFCC34D257B (FirebaseCppApp-10_1_1) uWS::HttpSocket<0>::upgrade
0x00007FFCC34CE401 (FirebaseCppApp-10_1_1) uWS::HttpSocket<0>::upgrade
0x00007FFCC34CEFD0 (FirebaseCppApp-10_1_1) uWS::HttpSocket<0>::upgrade
0x00007FFCC34CFC39 (FirebaseCppApp-10_1_1) uWS::HttpSocket<0>::upgrade
0x00007FFCC34CFF29 (FirebaseCppApp-10_1_1) uWS::HttpSocket<0>::upgrade
0x00007FFCC34CC763 (FirebaseCppApp-10_1_1) uWS::HttpSocket<0>::upgrade
0x00007FFCC34BF221 (FirebaseCppApp-10_1_1) uWS::HttpSocket<0>::upgrade
0x00007FFCC331D414 (FirebaseCppApp-10_1_1) uS::Node::getLoop
0x00007FFCC33073C7 (FirebaseCppApp-10_1_1) uS::Node::getLoop
0x00007FFCC32EB7FF (FirebaseCppApp-10_1_1) uS::Node::getLoop
0x00007FFCC32EBF8B (FirebaseCppApp-10_1_1) uS::Node::getLoop
0x00007FFCC32E4B89 (FirebaseCppApp-10_1_1) uS::Node::getLoop
0x00007FFCC32DA781 (FirebaseCppApp-10_1_1) uS::Node::getLoop
0x00007FFCC3292964 (FirebaseCppApp-10_1_1) uS::Socket::freeMessage
0x00007FFCC329BEFF (FirebaseCppApp-10_1_1) uS::Socket::freeMessage
0x00007FFD635A0E72 (ucrtbase) beginthreadex
0x00007FFD65847BD4 (KERNEL32) BaseThreadInitThunk
0x00007FFD65A8CED1 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========

or

firebase_unity_sdk_10.2.0 Log and Dump: https://drive.google.com/drive/folders/1qMX0iR3IXKz0_Ftu4eknTNBUtGcm7y7l?usp=sharing

========== OUTPUTTING STACK TRACE ==================

0x00007FFFB8291209 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB829256B (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB828E3F1 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB828EFC0 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB828FC29 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB828FF19 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB828C753 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB827F211 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB80DD414 (FirebaseCppApp-10_2_0) uS::Node::getLoop
0x00007FFFB80C73C7 (FirebaseCppApp-10_2_0) uS::Node::getLoop
0x00007FFFB80AB7FF (FirebaseCppApp-10_2_0) uS::Node::getLoop
0x00007FFFB80ABF8B (FirebaseCppApp-10_2_0) uS::Node::getLoop
0x00007FFFB80A4B89 (FirebaseCppApp-10_2_0) uS::Node::getLoop
0x00007FFFB809A781 (FirebaseCppApp-10_2_0) uS::Node::getLoop
0x00007FFFB8052964 (FirebaseCppApp-10_2_0) uS::Socket::freeMessage
0x00007FFFB805BEFF (FirebaseCppApp-10_2_0) uS::Socket::freeMessage
0x00007FF82A0B0E72 (ucrtbase) beginthreadex
0x00007FF82B167BD4 (KERNEL32) BaseThreadInitThunk
0x00007FF82C34CED1 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========

Steps to reproduce:

Click Run in Unity or click Stop

paulinon commented 1 year ago

Hi @Maskusa,

Could you verify if just having the Firebase SDK in your implementation results in a similar behavior? If so, please provide a minimal, reproducible example of your project so we can identify what's causing this.

Maskusa commented 1 year ago

I haven't checked yet if it's the Firebase SDK that's causing the crash, but I got a response from Unity support. I sent them many reports of these failures. I was told that the problem is in the Firebase SDK and I should contact Firebase support and provide these details that are listed above:

========== OUTPUTTING STACK TRACE ==================

0x00007FFFB8291209 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB829256B (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB828E3F1 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB828EFC0 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB828FC29 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB828FF19 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB828C753 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB827F211 (FirebaseCppApp-10_2_0) uWS::HttpSocket<0>::upgrade
0x00007FFFB80DD414 (FirebaseCppApp-10_2_0) uS::Node::getLoop
0x00007FFFB80C73C7 (FirebaseCppApp-10_2_0) uS::Node::getLoop
0x00007FFFB80AB7FF (FirebaseCppApp-10_2_0) uS::Node::getLoop
0x00007FFFB80ABF8B (FirebaseCppApp-10_2_0) uS::Node::getLoop
0x00007FFFB80A4B89 (FirebaseCppApp-10_2_0) uS::Node::getLoop
0x00007FFFB809A781 (FirebaseCppApp-10_2_0) uS::Node::getLoop
0x00007FFFB8052964 (FirebaseCppApp-10_2_0) uS::Socket::freeMessage
0x00007FFFB805BEFF (FirebaseCppApp-10_2_0) uS::Socket::freeMessage
0x00007FF82A0B0E72 (ucrtbase) beginthreadex
0x00007FF82B167BD4 (KERNEL32) BaseThreadInitThunk
0x00007FF82C34CED1 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========

I have one guess that I made based on the errors I get when I run some AAA games on PC. Some games won't launch for me due to error "c000001d" with description "Invalid application path: "

My PC username is set to "__". I changed it wherever possible to "Mask", but the username folder itself didn't change. I don't change it as it could break my whole system. Here is my path to the Crashes folder: C:/Users/__/AppData/Local/Temp/Unity/Editor/Crashes

Ps. I always use VPN when I work on PC.

My crashing issues only started after adding FirebaseDatabase to the project. Pps. this thread is the same as my problem. https://github.com/firebase/firebase-unity-sdk/issues/540

paulinon commented 1 year ago

Thanks for the additional input, @Maskusa. Could you verify if the issue persists with just the Firebase SDK in your implementation? If so, it would be great if you could provide the complete steps to replicate this behavior. Additionally, does disabling the VPN result in a different outcome other than crashes in the editor?

Maskusa commented 1 year ago

``At the moment I can't take the time to do further tests to discover more details.

I can say that I managed to solve the problem of the Fall of the Unity editor. I think that this solution is a crutch for me, but for your product it is a problem that needs to be solved.

I use the code to get data from FirebaseDatabase only when the user himself opens the desired section with statistics. Before that, I used the data update method:

void Start() 
{
UpdateCounters();
}

Now the version that works looks like this:

void Show_WindowStat()
{     
        Crashlytics.Log("Show_WindowStat()");        
#if UNITY_ANDROID && !UNITY_EDITOR
        FirebaseDatabase.DefaultInstance.GoOnline();
        UpdateCounters();
#endif
}

void Close_WindowStat()
{     
        Crashlytics.Log("Close_WindowStat()");        
#if UNITY_ANDROID && !UNITY_EDITOR
        FirebaseDatabase.DefaultInstance.GoOffline();
#endif
}

DatabaseReference dB_reference;

void UpdateCounters()
{
    dB_reference = FirebaseDatabase.DefaultInstance.RootReference;

    dB_reference.Child("text_1").GetValueAsync().ContinueWithOnMainThread(task =>
    {
    if (task.IsFaulted)
    {
        // Debug.Log("Handle the error...");
    }
    else if (task.IsCompleted)
    {
        DataSnapshot snapshot = task.Result;
        Debug.Log("text_1: " + snapshot.Value);            
        }           
    });

    dB_reference.Child("text_2").GetValueAsync().ContinueWithOnMainThread(task =>
    {
    if (task.IsFaulted)
    {
        // Debug.Log("Handle the error...");
    }
    else if (task.IsCompleted)
    {
        DataSnapshot snapshot = task.Result;
        Debug.Log("text_2: " + snapshot.Value);            
        }           
    });
}
paulinon commented 1 year ago

Hi @Maskusa,

Could you provide the code you originally used that was crashing the editor? This way, we can identify whether this is an intended behavior or not. You may opt to upload a reproducible project (with personally identifiable information scrubbed) to a GitHub repository and add me as a collaborator.

google-oss-bot commented 1 year ago

Hey @Maskusa. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 1 year ago

Since there haven't been any recent updates here, I am going to close this issue.

@Maskusa if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.