firebase / firebase/quickstart-unity

[Bug] PutStreamAsync is never completed if there is no internet connection

Open
#1,037 9 comments 0 reactions 0 assignees View on GitHub
api: storage type: bug
Dominant language
C#
Stars
923
Forks
456
PR merge metrics
No merged PRs in 30d

Description

* Unity editor version: 2019.4.21f1
* Firebase Unity SDK version: 7.1.0
* Source you installed the SDK: .unitypackage
* Problematic Firebase Component: Storage
* Other Firebase Components in use: Auth
* Additional SDKs you are using:
* Platform you are using the Unity editor on: Windows
* Platform you are targeting: iOS, Android
* Scripting Runtime: Mono and IL2CPP

I am using `Firebase Storage` and currently having an issue using `PutStreamAsync` when there is no internet connection. It seems like the task will never complete, even though I reduced `MaxUploadRetryTime` to 1 second or got the internet connection back. `Task.Status` is always `WaitingForActivation`

```
var task = storageReference.PutStreamAsync(ms, new MetadataChange()
{
CustomMetadata = GetMetaData()
}, null, CancellationTokenSource.Token);
```
Editor log:

```
ApplicationException: GetFutureStatus(handle) == kFutureStatusPending
Rethrow as ApplicationException: backing->status != kFutureStatusComplete
Firebase.Storage.StorageReferenceInternal.PutBytesUsingMonitorControllerAsync (System.IntPtr buffer, System.UInt32 buffer_size, Firebase.Storage.MetadataInternal metadata, Firebase.Storage.MonitorControllerInternal monitor_controller) (at Z:/tmp/tmp.0Ryilsblb3/firebase/storage/client/unity/proxy/StorageReferenceInternal.cs:148)
Firebase.Storage.StorageReference.PutBytesUsingMonitorControllerAsync (System.IntPtr buffer, System.UInt32 bufferSize, Firebase.Storage.MetadataInternal metadata, Firebase.Storage.MonitorControllerInternal monitorController, System.Threading.CancellationToken cancellationToken) (at Z:/tmp/tmp.0Ryilsblb3/firebase/storage/client/unity/proxy/StorageReference.cs:276)
Firebase.Storage.StorageReference.PutBytesUsingCompletionSourceAsync (System.Byte[] bytes, Firebase.Storage.MetadataChange customMetadata, System.IProgress`1[T] progressHandler, System.Threading.CancellationToken cancelToken, System.Uri previousSessionUri, System.Threading.Tasks.TaskCompletionSource`1[TResult] completionSource) (at Z:/tmp/tmp.0Ryilsblb3/firebase/storage/client/unity/proxy/StorageReference.cs:309)
Firebase.Storage.StorageReference+c__AnonStorey7.<>m__0 () (at Z:/tmp/tmp.0Ryilsblb3/firebase/storage/client/unity/proxy/StorageReference.cs:457)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at :0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at :0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at :0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at :0)
System.Threading.ThreadHelper.ThreadStart () (at :0)
UnityEngine.<>c:b__0_0(Object, UnhandledExceptionEventArgs)

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.