Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing snapshot crashes iOS every time, Editor eventually #635

Closed
aidanwolf opened this issue Apr 6, 2020 · 5 comments
Closed

Accessing snapshot crashes iOS every time, Editor eventually #635

aidanwolf opened this issue Apr 6, 2020 · 5 comments
Assignees
Milestone

Comments

@aidanwolf
Copy link

aidanwolf commented Apr 6, 2020

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

@aidanwolf aidanwolf added the new New issue. label Apr 6, 2020
@google-oss-bot
Copy link

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

@alexames
Copy link

alexames commented 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?

@alexames alexames added needs-info Need information for the developer type: bug and removed new New issue. labels Apr 6, 2020
@aidanwolf
Copy link
Author

aidanwolf commented Apr 7, 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));
                    }
          }
}

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Apr 7, 2020
@patm1987
Copy link

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

@patm1987 patm1987 added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels Apr 15, 2020
@DellaBitta DellaBitta self-assigned this Jun 17, 2021
@DellaBitta DellaBitta removed the needs-info Need information for the developer label Jun 28, 2021
@DellaBitta DellaBitta assigned a-maurice and unassigned DellaBitta Jun 28, 2021
@a-maurice a-maurice added this to the 8.1.0 milestone Jun 28, 2021
@a-maurice
Copy link
Contributor

This will be fixed with the 8.1.0 release

@firebase firebase locked and limited conversation to collaborators Jul 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants