Visitar URL original
Accessing snapshot crashes iOS every time, Editor eventually · Issue #635 · firebase/quickstart-unity · GitHub
Skip to content

Accessing snapshot crashes iOS every time, Editor eventually #635

Description

@aidanwolf

Please fill in the following fields:

Unity editor version: 2019.2.17f1
Firebase Unity SDK version: 6.13
Source you installed the SDK (.unitypackage or Unity Package Manager): .unitypackage
Firebase plugins in use (Auth, Database, etc.): Database, Storage, Auth, Analytics
Additional SDKs you are using (Facebook, AdMob, etc.): None
Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac
Platform you are targeting (iOS, Android, and/or desktop): iOS
Scripting Runtime (Mono, and/or IL2CPP):IL2CPP

Please describe the issue here:

This isn't for every snapshot, this is for an operation whereas I iterate over a snapshot of keys and get snapshots for those keys. Everything is async, running through Action callback. The crash seems to occur wherever the snapshot is accessed after whatever bug occurs, doesn't matter if its snapshot.HasChild, snapshot.Child().Value, or snapshot.Child().Exists.

`Obtained 6 stack frames.
#0 0x00000159763274 in firebase::database::internal::GetVariantValue(firebase::Variant const*)
#1 0x0000015975f888 in firebase::database::internal::VariantGetChild(firebase::Variant const*, firebase::Path const&)
#2 0x0000015974898a in firebase::database::internal::DataSnapshotInternal::HasChild(char const*) const
#3 0x000001596fdbb0 in Firebase_Database_CSharp_InternalDataSnapshot_HasChild__SWIG_0
#4 0x00000154419c33 in (wrapper managed-to-native) Firebase.Database.Internal.DatabaseInternalPINVOKE:InternalDataSnapshot_HasChild__SWIG_0 (System.Runtime.InteropServices.HandleRef,string) {0x7fd9358a6970} + 0x163 (0x154419ad0 0x154419db9) [0x17941bc80 - Unity Child Domain]
#5 0x007fd933934500 in (Unknown)
Launching bug reporter'

What's the issue repro rate? (eg 100%, 1/5 etc)
100% on iOS

Activity

  1. google-oss-bot commented on Apr 6, 2020

    @google-oss-bot

    This issue does not seem to follow the issue template. Make sure you provide all the required information.

  2. alexames commented on Apr 6, 2020

    @alexames

    Hi @aidanwolf,

    It looks like somehow the DataSnapshot is getting corrupted and passing garbage data around, which eventually causes the crash. I'm not sure what would be causing that though, so it would be helpful if we had a reproduction case. Can you show me a minimal, verifiable example that triggers this crash?

  3. added
    needs-infoNeed information for the developer
    and removed
    newNew issue.
    on Apr 6, 2020
  4. aidanwolf commented on Apr 7, 2020

    @aidanwolf
    Author

    Hi @aidanwolf,

    It looks like somehow the DataSnapshot is getting corrupted and passing garbage data around, which eventually causes the crash. I'm not sure what would be causing that though, so it would be helpful if we had a reproduction case. Can you show me a minimal, verifiable example that triggers this crash?

    Hi Alexames!

    I have discovered the source of the issue. If enumerating through a snapshot's children and attempting to access the enumerated child value later with any arbitrary delay, there's a chance it will have Nulled out. Not sure why it's doing this, but it definitely seems to be a bug.

    Bad Code

    public void SnapshotReader (DataSnapshot snapshot) {
    foreach (var MyParent in snapshot.Child("parents").Children) {
                        foreach (var MyObject in MyParent.Children) {
                                 StartCoroutine(WaitRandom(MyObject));
                        }
              }
    }
    
    public IEnumerator WaitRandom (DataSnapshot MyObject) {
           yield return new WaitForSeconds(Mathf.Random(0.5f,3f));
           Debug.Log(MyObject.GetRawJsonValue());
    }
    

    Working code

    public void SnapshotReader (DataSnapshot snapshot) {
    foreach (var MyParent in snapshot.Child("parents").Children) {
                        foreach (var MyObject in MyParent.Children) {
    StartCoroutine(WaitRandom(snapshot.Child("parents").Child(MyParents.Key).Child(MyObject.Key));
                        }
              }
    }
    
  5. added and removed
    needs-infoNeed information for the developer
    on Apr 7, 2020
  6. patm1987 commented on Apr 15, 2020

    @patm1987

    Hi @aidanwolf ,

    Thanks for doing all this legwork! Would you mind throwing a quick example together built on the quickstart? I'll be able to throw that right into a bug report to start taking a look at the issue.

    Thanks!
    --Patrick

  7. added
    needs-infoNeed information for the developer
    and removed on Apr 15, 2020
  8. self-assigned this
    on Jun 17, 2021
  9. added this to the 8.1.0 milestone on Jun 28, 2021
  10. a-maurice commented on Jun 28, 2021

    @a-maurice
    Contributor

    This will be fixed with the 8.1.0 release

  11. locked and limited conversation to collaborators on Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions