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

[Bug] Persistent connection error thrown when using Unity 2022 on Mac #1023

Open
lmt385 opened this issue May 9, 2024 · 3 comments
Open
Labels
api: database needs-attention Need Googler's attention

Comments

@lmt385
Copy link

lmt385 commented May 9, 2024

Description

When setting up or triggering ValueChanged callbacks for a DatabaseReference, errors are being thrown by the SDK in Unity Editor.
These errors only occur to our Mac machines, Windows machines and Android devices are unaffected.

The ValueChanged callbacks can be triggered, but they can then cause the same error that occurred when setting up the listener.

Originally observed this on Firebase version 10.7, upgraded to 11.9.0 and issue is still present.

Reproducing the issue

  1. DatabaseReference is obtained for a particular node in the Firebase Realtime Database
  2. A ValueChanged callback is added to the DatabaseReference object
  3. Error is triggered referencing persistent_connection.cc
  4. If a corresponding value is changed in the Firebase Realtime Database, the callback is triggered and so is the error. The callback is executed successfully.

Firebase Unity SDK Version

11.9.0

Unity editor version

2022.3.23f1

Installation Method

.unitypackage

Problematic Firebase Component(s)

Database

Other Firebase Component(s) in use

Analytics, Authentication, Storage

Additional SDKs you are using

Azure Speech, AWS

Targeted Platform(s)

Android

Unity editor platform

Mac

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

Relevant Log Output

/Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/firebase-cpp-sdk/database/src/desktop/connection/persistent_connection.cc(367): listens_.find(query_spec) == listens_.end()
UnityEngine.Debug:LogError (object)
Firebase.Platform.FirebaseLogger:LogMessage (Firebase.Platform.PlatformLogLevel,string) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseLogger.cs:95)
Firebase.LogUtil:LogMessage (Firebase.LogLevel,string) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:69)
Firebase.LogUtil:LogMessageFromCallback (Firebase.LogLevel,string) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:77)
Firebase.AppUtil:PollCallbacks () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/android_unity/armeabi-v7a/app/swig/Firebase.App_fixed.cs:4869)
Firebase.Platform.FirebaseAppUtils:PollCallbacks () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/FirebaseAppUtils.cs:33)
Firebase.Platform.FirebaseHandler:Update () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseHandler.cs:208)
Firebase.Platform.FirebaseMonoBehaviour:Update () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseMonoBehaviour.cs:45)

If using CocoaPods for Apple platforms, the project's Podfile.lock

Expand Podfile.lock snippet
👀 Replace this line with the contents of your Podfile.lock!
@lmt385 lmt385 added new New issue. type: bug labels May 9, 2024
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@argzdev
Copy link

argzdev commented May 10, 2024

Hey @lmt385, thanks for reaching out. I'm trying to test your scenario using our quickstart repo but it seems to work just fine. I'm testing with version Firebase Realtime Database 11.9.0 and Unity Editor 2022.3.24f1. That said, could you answer the following:

  1. You mentioned in [3] that "Error is triggered referencing persistent_connection.cc". Are you saying after adding ValueChanged callback, the error is already triggered?
  2. Can you provide a MCVE so that we can check if there's a difference in setup that's causing this issue"

Thanks in advance!

@argzdev argzdev added the needs-info Need information for the developer label May 10, 2024
@lmt385
Copy link
Author

lmt385 commented May 10, 2024

Hello,
The error triggers upon the callback being registered, yes.

I'll see what I can do in terms of providing a MCVE.

Edit: While digging deeper, it doesn't seem to be triggering upon the listeners being registered, but at a later point related to the initial callbacks when calling GetValueAsync.

The general flow is:

  1. 3 OnValueChanged callbacks assigned, followed by 7 more once those are finished
  2. The ValueChanged callbacks in turn call a method that uses GetValueAsync for a child reference, if the value returned by the callback meets a condition
    a. So, it goes: ValueChanged Callback associated with reference.Child("attribute") -> Callback checks if condition is met -> Method that calls await reference.Child("setting").GetValueAsync()
  3. On the Mac Editor, GetValueAsync is triggering the persistent_connection.cc error if present in this flow. When commented out, the code executes without issue. GetValueAsync does not cause an error if it is not associated with the callback.

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels May 10, 2024
@argzdev argzdev removed the type: bug label Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: database needs-attention Need Googler's attention
Projects
None yet
Development

No branches or pull requests

3 participants