firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
215 stars 35 forks source link

[Bug] There are cases where storage cannot be canceled normally. #576

Closed henry-dreamo closed 1 year ago

henry-dreamo commented 1 year ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

We are using Admob plugin together. Rarely, there was a case where a crash occurred while exposing Admob ads while transferring to Firebase storage. (I think the crash shouldn't happen) Anyway, to solve this problem, I canceled the upload task right before displaying AdMob ads using CancellationToken.

But the following error occurs. image

I suspect that there is no controller, but I am not sure, so I ask a question. image

When I canceled, I also found the following log.

[Firebase]InnerException:System.AggregateException: One or more errors occurred. ("_p_firebase__storage__MonitorController" has been disposed)

It's on the Firestore side, but I wonder if it's not related to pull request

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? No

What's the issue repro rate? Rarely reproduced. It happens when canceling while transferring to storage, and it seems to happen when canceling a little late.

Relevant Code:

        storageCts_ = new CancellationTokenSource();
        CancellationToken cToken = storageCts_.Token;

        var uploadRef = reference.Child(remotePath_);
        uploadRef.PutFileAsync(localPath_, metaData, progressMonitor, cToken).ContinueWithOnMainThread(HandleTask);

It is called as below just before viewing the ad.

        if (storageCts_ == null || storageCts_.IsCancellationRequested)
        {
            return;
        }

        storageCts_.Cancel();
paulinon commented 1 year ago

Hi @henry-dreamo,

Thanks for reporting this. I'd like to clarify a few things:

henry-dreamo commented 1 year ago

Hi @paulinon

  1. First of all, we will apply Firebase 10.3.0 in the next update.
  2. It has not yet been released with that error popping up, so only the test device Galaxy S10e exists.
  3. Admob removal requires a lot of resources, so it's hard to test right now.
paulinon commented 1 year ago

Thanks for the update, @henry-dreamo. While waiting for the results of your update, would it be possible for you to provide a minimal, reproducible example of your implementation so that we can identify what's causing this behavior?

henry-dreamo commented 1 year ago

I will make a reproducible sample project when I have time. First of all, please note that I will attach the stack where this crash appears.

image

image

image

paulinon commented 1 year ago

Thanks for sharing this information, @henry-dreamo. I look forward to the results of your update.

google-oss-bot commented 1 year ago

Hey @henry-dreamo. 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!

henry-dreamo commented 1 year ago

Yes. It will be updated to a new version tomorrow. I'll check again after the update. I'm leaving a comment so this issue doesn't close.

henry-dreamo commented 1 year ago

@paulinon We updated the app version by updating the Firebase version. Exception handling was also performed to check if UploadTask was terminated. The issue has been resolved.