-
Notifications
You must be signed in to change notification settings - Fork 428
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 GetBytesAsync crash for gzip-encoded file #986
Comments
Hi,
Could you verify if our quickstart example crashes for you on Android too? If yes, could you try enabling debug logging and running once again,
|
Thank you for the reply! Did you also set the content encoding metadata to gzip for the gz stream? To be clear, it is the (correct) metadata that causes SDK to crash, there is no problem per se in storing gzipped streams without encoding metadata. I'm not sure if that can be done via the console web interface, hence I used |
I see. I didn't try setting the content encoding metadata though the file type is identified as "application/x-gzip |
Hi @vimanyu , Instructions for reproducing the crash with the quickstart-unity project. You do not need to make any changes.
This works as expected in Editor, but produces a crash as shown on the top of this thread on Android. Tested with trunk on this repo and the linked Firebase SDK 7.1.0 for XCode 12 and dotnet4. Unity 2019.4.14f1. If you omit |
Hi @vnorilo, I followed your repro steps, use gsutil with -Z to upload a file, and download bytes with no issue. Is there any other steps that I should pay attention to? How big is your file? |
Hi Cynthia! Thanks for picking this up. Perhaps it results from a combination of Firebase SDK and Android system. As I speculated on top of this thread, Google Cloud will automatically decompress bytestreams when the http request doesn't have At this point all I can really do is to try to make sure all the details are correct. Here I've got two files, Metadata as per gsutil
I've attached screenshots of the quickstart app on the crashing device and the device system info screen. Crash downloading readme.mdSuccess downloading readme-identity.md(after correcting typoed url :P ) DeviceThanks again! |
Hi @vnorilo, I managed to repro the issue both with our unity testapp and android testapp, our team will be looking into solve the issue. Update: in the next release of firebase-storage:19.2.2 will contain a potential fix for the issue. Let's wait for the release to get out and check whether it's fixed. Thanks for being patient. |
This might not need a fix in the Android Storage SDK, but we need to fix our documentation to state that -1 is a valid return value: firebase/firebase-android-sdk#2618 |
Unity C code did not check Judge by the user's callstack, this seem to be thrown from native Android SDK.
Perhaps it works with StorageReference.getBytes() and StorageReference.getStream() but not StorageReference.getStream(StreamDownloadTask.StreamProcessor processor) ? |
Further dig: The exception is thrown from this code, which is indeed part of C /Unity SDK. However, judged by the code, it does not seem to be an issue in C /Unity SDK. Here is the reason: The user specified the maxDownloadSizeBytes is 1,000,000 byts = 1Mb. That is,
The gzip file provided by the user is This implies that This does not seem to be the same issue to firebase/firebase-android-sdk#2618 @schmidt-sebastian also mentioned that the backend does not provide the file size of |
Update: Tried Android testapp and it does not seems like anything odd about the value in The seems to plague both The only workaround for this probably is to download the file to Android device using Will need to further investigate into the issue. |
[REQUIRED] Please fill in the following fields:
[REQUIRED] Please describe the issue here:
Android client crashes when calling
GetBytesAsync
for a Storage reference that points to a gzip-encoded file. In editor, the method works fine and provides the compressed stream bytes.Steps to reproduce:
What happened? How can we make the problem occur?
gsutil cp -Z <local-file> <gs://remote-file>
FirebaseStorage.DefaultInstance.GetReference(<remote-file>).GetBytesAsync(1000000)
On Android device, the call will always crash, even when the file is much, much smaller than the provided limit:
My suspicion is that the Android client allocates the byte buffer based on file size in storage. However, the fetch fails to send
accepts: gzip
to the server, which should cause automatic decompression in Google Cloud Storage and the resulting uncompressed stream is too big to fit the buffer, whose size may be based on the compressed size.The text was updated successfully, but these errors were encountered: