Repository navigation
Accessing snapshot crashes iOS every time, Editor eventually #635
Description
Activity
This issue does not seem to follow the issue template. Make sure you provide all the required information.
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?
- addedneeds-infoNeed information for the developerNeed information for the developerand removednewNew issue.New issue.
on Apr 6, 2020 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)); } } }- addedneeds-attentionNeed Googler's attentionNeed Googler's attentionand removedneeds-infoNeed information for the developerNeed information for the developer
on Apr 7, 2020 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- addedneeds-infoNeed information for the developerNeed information for the developerand removedneeds-attentionNeed Googler's attentionNeed Googler's attention
on Apr 15, 2020 - removedneeds-infoNeed information for the developerNeed information for the developer
on Jun 28, 2021 This will be fixed with the 8.1.0 release
- locked and limited conversation to collaborators
on Jul 29, 2021
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