-
Notifications
You must be signed in to change notification settings - Fork 115
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] StorageReferenceInternal::GetFile path argument is not copied #1570
Comments
Never mind, Objective-C blocks seem to handle that differently. The actual error I was getting was that local file url was not url encoded (e.g. it had spaces in the path). I'm still getting an error upon second download of the same file, which seems to be in Firebase code not specifying
|
Alright, I'd let you guys decide whether this is an actual bug or not as I start getting crashes again and I see garbage in path pointer every time that happens. I don't know Objective-C well enough to vouch whether its runtime makes a proper copy of C-string inside its block. Here is additionally a slightly different call stack from the recent EXC_BREAKPOINT I see, which seem to point to the fact it happens due to processing of garbage in the path string:
I probably was just lucky a few times when crash didn't happen last night and I closed this bug. Reopening for you to decide. P.S. All the Firebase component come from 11.9.0 downloaded from the website except for libfirebase_storage.a, which I built with debug information from commit |
Looks like this actually is a bug if your C++ code is running outside of the main (UI) thread:
This code uses the Shouldn't be too difficult a fix, thanks for raising the issue. |
Thank you, @jonsimantov! That actually explains why I didn't see the crash a few times leading me to close the bug. To repro the issue, I commented out other code that tries using On-Demand Resources before the Firebase Storage is used as a back-up. That caused the actual call to happen on the main thread. When I restored the original logic, the call happens from a callback on a different thread. |
I can confirm the issue is resolved in 12.0.0 |
[REQUIRED] Please fill in the following fields:
[REQUIRED] Please describe the issue here:
The argument path of
StorageReferenceInternal::GetFile
is not copied and passed verbatim as a pointer to another thread in:download_task = [my_impl writeToFile:[NSURL URLWithString:@(path)] completion:completion];
This would not work if path was passed from a C++ temporary and the expectation that the caller must ensure the lifetime of path supersedes the download time is unrealistic. Most developers would expect path to be copied if you need to carry it to another thread.
Stack trace during EXC_BREAKPOINT (code=1, subcode=0x1bc5fa4b0) as it processes garbage after temporary:
Steps to reproduce:
No. Your Firebase C++ quickstarts is useless in reproducing real-world issues as it busy-waits after each call, hiding all the multi-threading issues you guys have. This is just one of them, more to follow. Rewrite it to include multi-threading scenarios.
What's the issue repro rate? 100%
Just use the following function to reproduce the problem:
Relevant Code:
The text was updated successfully, but these errors were encountered: