Resuming UploadTask results in E / StorageException: BufferedInputStream closed
I am having trouble resuming UploadTask from a suspended state. I can download the video successfully if I let it finish without trying to pause the download. According to the Firebase Storage Android Documentation , you can use a function resume
to resume a previously downloaded UploadTask program. Unfortunately, when I try to execute the sample myself, I observe
04-11 15: 20: 36.285 9432-9660 / io.pristine.firebasesample E / UploadTask: Unable to read bytes to load java.io.IOException: Stream closed at java.io.BufferedInputStream.getBufIfOpen (BufferedInputStream.java:162) at java.io.BufferedInputStream.read (BufferedInputStream.java:325) at com.google.android.gms.internal.zzbtu.zzqP (Unknown Source) at com.google.firebase.storage.UploadTask.zzacR (Unknown source) at com.google.firebase.storage.UploadTask.run (Unknown source) at com.google.firebase.storage.StorageTask $ 8.run (Unknown source) at java.util.oolconcurrent.ThreadPoolExecutor.PunWorker (ThreadPoolExecutor.runWorker (Thread .java: 1133) at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:607) at java.lang.Thread.run (Thread.java:761)run (Unknown source) at com.google.firebase.storage.StorageTask $ 8.run (Unknown source) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor $ Worker. run (ThreadPoolExecutor.java:607) in java.lang.Thread.run (Thread.java:761)run (Unknown source) at com.google.firebase.storage.StorageTask $ 8.run (Unknown source) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor $ Worker. run (ThreadPoolExecutor.java:607) in java.lang.Thread.run (Thread.java:761)1133) at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:607) at java.lang.Thread.run (Thread.java:761)1133) at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:607) at java.lang.Thread.run (Thread.java:761)
And another one right after that:
04-11 15: 20: 36.285 9432-9660 / io.pristine.firebasesample E / StorageException: A StorageException event occurred. An unknown error has occurred, check the HTTP result code and internal exception for the server response. Code: -13000 HttpResult: 200
HttpResult 200 seems to be normal and - 13000 looks like ERROR_UNKNOWN
Basic steps to reproduce in case the github repository is down:
- Authentication using firebase validation (not sure if this is necessary)
- Copy the binary from assets (you can probably read from SD card if you like)
- Start UploadTask with putFile (Uri, StorageMetadata)
- Pause uploadTask by calling UploadTask.pause () after the upload starts and before it finishes
- Resume the upload in a second or two as soon as you confirm it by pausing it by calling UploadTask.resume ()
- Observe save storage
I am using firebase-database:10.2.1
, firebase-auth:10.2.1
and firebase-storage:10.2.1
as the only dependencies and tested on multiple devices with google play services. ( Google Play Availability: SUCCESS
)
The purpose of this feature is to allow application users to manually pause and resume downloads. (Some of them are in wi-fi hotspots which are measured and not visible for Android OS that I know of)
source to share