-
Notifications
You must be signed in to change notification settings - Fork 38
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] Storage PutFileAsync/PutBytesAsync stops transfering bytes after exactly 5 minutes, throws "Firebase.Storage.StorageException: The operation retry limit has been exceeded" after exactly 5 more minutes #968
Comments
Hi @TobiasWehrum, Does setting
If that doesn't work, could you provide a minimal, reproducible example of your implementation so that we can identify what's causing this to happen? |
@paulinon When I tested that yesterday (with I'll make an example later. |
@paulinon, here is how to reproduce the problem using Unity 2022.3.17f1 on Windows 10 in the editor. I get a 100% reproduction rate on this.
If you try step 10 again while commenting in the second PutFileAsync block in UploadTest.cs, you can observe that any new call to PutFileAsync after the Example log output excerpt:
UploadTest.cs: using System;
using System.Threading;
using Firebase;
using Firebase.Storage;
using UnityEngine;
public class UploadTest : MonoBehaviour
{
[SerializeField] private string firebaseStorageUrl;
[SerializeField] private string storagePathStringForUpload;
[SerializeField] private string localFilePathForUpload;
private CancellationTokenSource cancellationTokenSource;
protected async void Awake()
{
var depencencyResult = await FirebaseApp.CheckAndFixDependenciesAsync();
if (depencencyResult != DependencyStatus.Available)
{
Debug.LogError("FirebaseApp.CheckAndFixDependenciesAsync failed.");
return;
}
var storage = FirebaseStorage.DefaultInstance;
var storageRef = storage.GetReferenceFromUrl(firebaseStorageUrl);
cancellationTokenSource = new CancellationTokenSource();
var startTime = Time.realtimeSinceStartup;
var progressHandler = new StorageProgress<UploadState>(state =>
{
var currentTime = TimeSpan.FromSeconds(Mathf.FloorToInt(Time.realtimeSinceStartup - startTime));
Debug.Log($"[{currentTime}] Transfered: {state.BytesTransferred} of {state.TotalByteCount} bytes");
});
try
{
await storageRef.Child(storagePathStringForUpload).PutFileAsync(localFilePathForUpload, null, progressHandler, cancellationTokenSource.Token, null);
Debug.Log("Upload finished");
}
catch (Exception e)
{
Debug.LogError(e);
}
/*
// If you comment this block in, Unity will freeze immediately when calling PutFileAsync() (after the previous block failed with a StorageException).
// Editor.log will only show a single line before ending abruptly:
// ERROR: ret == ((((DWORD )0x00000000L) ) + 0 )
try
{
await storageRef.Child(storagePathStringForUpload).PutFileAsync(localFilePathForUpload, null, progressHandler, cancellationTokenSource.Token, null);
Debug.Log("Upload finished");
}
catch (Exception e)
{
Debug.LogError(e);
}
*/
cancellationTokenSource = null;
}
protected void OnDestroy()
{
if (cancellationTokenSource != null)
{
cancellationTokenSource.Cancel();
cancellationTokenSource = null;
}
}
} |
Hi @TobiasWehrum, Thanks for the additional information. I was able to reproduce the issue, and it persists even after setting the upload retry time. That said, I'll be relaying my observations to our team. You may refer to this thread for updates. |
Thank you, @paulinon - looking forward to this getting resolved. On a related note, I think the same bug might apply not just to uploading, but also to downloading. I didn't have time to investigate yet, but yesterday I observed a particularly big download on a slow internet connection that seemed to stop after about 5 minutes, and then threw a |
@paulinon I just tested it to confirm it: Literally the same (stops transfering after 5 minutes, operation retry limit StorageException at 10 minutes) happens when downloading via |
This should be fixed with the latest release, https://github.com/firebase/firebase-unity-sdk/releases/tag/v11.9.0 |
@a-maurice Thanks for the fix and the info what it was! It doesn't sound like the curl timeout should lead to the observed crashes/freezes though. There might be a secondary bug here that could occur under other conditions too, like e.g. when "The operation retry limit has been exceeded" is thrown for other reasons. |
Yeah, it is certainly possible, and we will keep an eye out for possible fixes for that. |
[REQUIRED] Please fill in the following fields:
[REQUIRED] Please describe the issue here:
I'm trying to upload a 423 MB video file with PutFileAsync while using a progress handler to show the upload progress.
After exactly 5 minutes the upload always seems to stop: The progress handler continues to be called, but BytesTransferred will keep the value it had at the 5 minute mark (instead of steadily progressing like before).
After exactly 5 more minutes PutFileAsync throws
Firebase.Storage.StorageException: The operation retry limit has been exceeded
.If I try to upload anything else after that exception in the Unity Editor the whole Editor will freeze and has to be closed via Task manager.
If I try to upload anything else after that exception in a build, the app will either directly crash or will throw a
System.ApplicationException: ret == ((((DWORD )0x00000000L) ) + 0 ) ---> System.ApplicationException: ret == ((((DWORD )0x00000000L) ) + 0 )
immediately.This happens in the Unity Editor and in a desktop build on Windows 10 every single time I tested it. I also tested PutBytesAsync in the Unity Editor, and it has the exact same behaviour.
We also tested tested this in a build on another Windows 10 machine, and there too we got
Firebase.Storage.StorageException: The operation retry limit has been exceeded
after pretty much exactly 10 minutes (and then the System.ApplicationException if we tried to upload again).If I set MaxDownloadRetryTime, MaxUploadRetryTime and MaxOperationRetryTime to 1 second,
Firebase.Storage.StorageException: The operation retry limit has been exceeded
will be thrown right after BytesTransferred stops increasing, further suggesting that something goes wrong there and that it starts retrying at that point.The text was updated successfully, but these errors were encountered: