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] Remote Config FetchAsync throws exception with TimeSpan #1138

Open
Nyankoo opened this issue Sep 13, 2021 · 39 comments
Open

[Bug] Remote Config FetchAsync throws exception with TimeSpan #1138

Nyankoo opened this issue Sep 13, 2021 · 39 comments

Comments

@Nyankoo
Copy link

Nyankoo commented Sep 13, 2021

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2020.3.18f1
  • Firebase Unity SDK version: 8.1.0
  • Source you installed the SDK: Unity Package Manager
  • Problematic Firebase Component: Remote Config
  • Other Firebase Components in use: Firestore, Crashlytics, Auth
  • Additional SDKs you are using:
  • Platform you are using the Unity editor on: Windows
  • Platform you are targeting: Android (Unity Editor is also affected)
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the issue here:

When setting the cache expiration of FetchAsync() to TimeSpan.Zero (or any other TimeSpan), an exception is thrown with ErrorCode 1. The Message parameter is empty.

Steps to reproduce:

Relevant Code:

await FirebaseRemoteConfig.DefaultInstance.FetchAsync(TimeSpan.Zero); //This (or any other TimeSpan) will result in an exception
@paulinon
Copy link
Contributor

Hi @Nyankoo,

Thanks for reporting this issue. Version 8.2.0 of the SDK has been released recently. Could you verify if the issue persists there as well? If it does, please provide a minimal, reproducible example of your project along with the complete steps to replicate this behavior.

@paulinon paulinon added the needs-info Need information for the developer label Sep 14, 2021
@Nyankoo
Copy link
Author

Nyankoo commented Sep 14, 2021

@paulinon Did something in Version 8.2.0 change related to Remote Config? The changelog doesn't mention anything.

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Sep 14, 2021
@paulinon
Copy link
Contributor

Hi @Nyankoo,

While the release notes don't mention anything related to Remote Config, this is to ensure that the issue persists even with the latest updates and fixes.

I look forward to your findings.

@paulinon paulinon added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels Sep 15, 2021
@DanForstinger
Copy link

I can confirm we are seeing this issue, on 8.2.0. It's causing our app to fully hang.

We are sending in a timespan of 1 minute. We started seeing this about 4 weeks ago. Can confirm removing the timespan argument stopped the issue from happening, but we can't wait for ~12 hours for remote config updates!

Should be simple enough to reproduce in an empty project on your end.

@Nyankoo
Copy link
Author

Nyankoo commented Sep 15, 2021

@paulinon We didn't had a change to update, but Dan's report shows that this is also happening with 8.2.0.

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Sep 15, 2021
@DanForstinger
Copy link

Also note @paulinon in our tests, this happened about 2/10 times-ish.

@DanForstinger
Copy link

If we remove the cache expiry, it works 100% of the time.

@paulinon
Copy link
Contributor

Thanks for the input, @Nyankoo and @DanForstinger. So far, I have not encountered the exception when using the FetchAsync() function. A minimal, reproducible example would be helpful in identifying what's causing the exception.

Could you also confirm if the same exception persists using the quickstart?

@paulinon paulinon added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels Sep 16, 2021
@DanForstinger
Copy link

A few notes that may help you reproduce:

  • This was happening only on device, about ~10-20% of the time. Youll have to try a few times on device to reproduce.
  • It only happens if you call FetchAsync with a timespan, for example: FetchAsync(TimeSpan.FromMinutes(1)) is what our call was. FetchAsync() with no arguments works fine.

@DanForstinger
Copy link

For us, the app just hangs and never calls back from the async function, though we may not have got the errors because the initialization wasn't finishing on the main thread.

@fonograph
Copy link

To clarify, the situation Dan is describing is only happening after building on certain machines (CI vs local build), and only shows up at all for some % of users (some people don't see it at all.) It also started appearing randomly for an existing game we'd launched and made no changes to — which actually seems to suggest this is something happening on the firebase server side, rather than the unity side.

@Nyankoo
Copy link
Author

Nyankoo commented Sep 17, 2021

Just posting to put the correct labels, as everything was already described by Dan and fonograph.

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Sep 17, 2021
@paulinon
Copy link
Contributor

Hi @Nyankoo, @DanForstinger, and @fonograph,

I have called the function on both an Android build and the Unity editor at least twenty times, but none of them resulted into an exception or issue.

There's a possibility that the issue is related to the device used. In order to verify if this is the case, could you provide the device models along with their respective Android versions?

If the issue doesn't persist when using the quickstart, it would be helpful if you provide a minimal, reproducible example of a project with this issue

@paulinon paulinon added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels Sep 20, 2021
@google-oss-bot
Copy link

Hey @Nyankoo. 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 google-oss-bot added the stale Don't have recent activity label Nov 26, 2021
@google-oss-bot
Copy link

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

@Nyankoo 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.

@flogavel
Copy link

Hi all, I have the same issue..

FirebaseRemoteConfig.FetchAsync(TimeSpan) sometimes (25 to 50% of the time) never returns a result on iOS devices (works well on android devices).
Using FirebaseRemoteConfig.FetchAsync() solves the issue but we just can't afford to have a 12hours cache in our app.

Bug occurs on all our iOS devices.

Unity editor version: 2020.3.18f1 (also tried some 2019 versions)
Firebase Unity SDK version: 7.1.0
Source you installed the SDK: Unity Package Manager
Problematic Firebase Component: Remote Config
Other Firebase Components in use: Firestore, Crashlytics, Auth
Additional SDKs you are using:
Platform you are using the Unity editor on: Mac
Platform you are targeting: iOS
Scripting Runtime: IL2CPP

Here's a code snippet if that can help :

// this method is called in the Start function of our main scene (but several scenes come before that one)
 void InitializeFirebaseRemoteConfig()
        {
            // These are the values that are used if we haven't fetched data from the
            // server
            // yet, or if we ask for values that the server doesn't have:

            _FirebaseRemoteConfig = FirebaseRemoteConfig.DefaultInstance;

            Dictionary<string, object> defaults = new Dictionary<string, object>
            {
                { "config_test_string", "default local string" },
                { "config_test_int", 1 },
                { "config_test_float", 1.0 },
                { "config_test_bool", false }
            };

            _FirebaseRemoteConfig.SetDefaultsAsync(defaults).ContinueWithOnMainThread(fetchTask1 =>
            {
                _FirebaseRemoteConfig.FetchAsync(new TimeSpan(0, 0, 10)).ContinueWithOnMainThread(fetchTask2 =>
                {
                    // doing our stuff here
                    // 25-50% of the time on iOS, we can't get here
                });
            });
        }

@guerwan
Copy link

guerwan commented Dec 13, 2021

@google-oss-bot we are still having this issue, detailed information provided in the comment above, could you please reopen this issue?

@Nyankoo
Copy link
Author

Nyankoo commented Dec 13, 2021

@DellaBitta @paulinon Please re-open the issue, thanks!

@DellaBitta DellaBitta reopened this Dec 13, 2021
@DellaBitta DellaBitta added needs-attention Need Googler's attention and removed closed-by-bot stale Don't have recent activity needs-info Need information for the developer labels Dec 13, 2021
@DellaBitta
Copy link
Contributor

DellaBitta commented Dec 20, 2021

Hi @flogavel,

Thanks for the test case. I was able to reproduce the issue by replacing the quickstart code for InitializeFirebase with your implementation:

void InitializeFirebase()
{
      System.Collections.Generic.Dictionary<string, object> defaults = new System.Collections.Generic.Dictionary<string, object>
      {
          { "config_test_string", "default local string" },
          { "config_test_int", 1 },
          { "config_test_float", 1.0 },
          { "config_test_bool", false }
      };

Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.SetDefaultsAsync(defaults).ContinueWithOnMainThread(fetchTask1 =>
      {
        DebugLog("RemoteConfig configured and ready!");
        isFirebaseInitialized = true;
        Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.FetchAsync(new TimeSpan(0, 0, 10)).ContinueWithOnMainThread(fetchTask2 =>
          {
            DebugLog("Fetch Returned");
          });
      });
}

Tested this on iOS built with Unity 2020.3.20f1 LTS.

Marking this as a bug, thank you!

@tinyrickguy
Copy link

For those who are having this issue, we were able to resolve it by making sure that there are ZERO calls to the Firebase SDK before it has finished initializing. In our case, we were calling FirebaseRemoteConfig.DefaultInstance.Keys before CheckAndFixDependenciesAsync has finished calling its callback, which was the trigger to the broken behaviour described here.
Not sure that it's the exact same issue others are having, but it did help us.

@Nyankoo
Copy link
Author

Nyankoo commented Feb 2, 2022

We're awaiting CheckAndFixDependenciesAsync and initiate all other calls to the Firebase SDK after it returns with DependencyStatus.Available, so it seems this is unrelated.

@jonsimantov jonsimantov self-assigned this Feb 7, 2022
@jonsimantov
Copy link
Contributor

For those experiencing the issue where Fetch() hangs on iOS, please see #1198 (comment) for more information. For Android, we are still looking into the issue.

@a-maurice
Copy link
Contributor

Hey all,

Firebase SDK for Unity 8.9.0 is now live, which contains a fix for this issue, and you can download it directly here, or through the usual places like the package manager.

I'm going to close this issue for now, but please let us know if there are any outstanding problems.

@Nyankoo
Copy link
Author

Nyankoo commented Apr 7, 2022

@a-maurice Just tested with 8.9.0, and the original issue is still happening when we call
FirebaseRemoteConfig.DefaultInstance.FetchAsync(TimeSpan.Zero)

@Nyankoo
Copy link
Author

Nyankoo commented Apr 8, 2022

@a-maurice @DellaBitta Please re-open this issue to continue to keep track of it.

@DellaBitta DellaBitta reopened this Apr 8, 2022
@a-maurice
Copy link
Contributor

@Nyankoo are you still seeing it in both Android and the editor?

@Nyankoo
Copy link
Author

Nyankoo commented Apr 9, 2022

@a-maurice This currently only seems to happen in the Editor (tested on Android, not iOS), but I will update here when we released an update to our app and see if the issue still appears in Crashlytics.

@Nyankoo
Copy link
Author

Nyankoo commented Apr 16, 2022

@a-maurice We're still seeing this in Crashlytics happening to our users, so it doesn't seem to be fixed on Android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests