-
-
Notifications
You must be signed in to change notification settings - Fork 874
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
PFFile raises exception when getting data from caches #528
Comments
Super strange and shouldn't happen. |
Thank you for your feedback. We prioritize issues that have clear and concise repro steps. Please see our Bug Reporting Guidelines about what information should be added to this issue.
|
@nlutsenko Any update on this. I similarly cannot receive errors when I try to load PFFiles. |
@dtaitz Any chance you can post the stack trace for all threads of the app the moment it crashes? Or better - whilst debugger is attached - post a file path of the file its trying to get the file from. |
@nlutsenko The app doesn't crash. I just get a lot of errors and the the images do not load from the file. The images are definitely saved to Parse. There is definitely a change I am trying to load nil PFFile's, but that had not been a problem in the past. I am using the PFImageView ParseUI element. Here is the backtrace: thread #3: tid = 0x35c05b, 0x000000019acec4fc libsystem_kernel.dylib thread #5: tid = 0x35c05e, 0x000000019aceb440 libsystem_kernel.dylib thread #6: tid = 0x35c05f, 0x000000019acd0a40 libsystem_kernel.dylib thread #7: tid = 0x35c061, 0x000000019aceba38 libsystem_kernel.dylib thread #8: tid = 0x35c06f, 0x000000019acd0a40 libsystem_kernel.dylib
|
Sorry for late response - I cannot reproduce this anymore after I have uninstalled the app and installed it back. Most probably it was caused by parse sdk update when the app installed was once run with an older sdk. There is also another guy having the same problem here https://groups.google.com/d/msg/parse-developers/c2HL3kmqWWU/XehgdSlqCQAJ last comment in that thread is mine so just ignore it - i copied it here. |
FYI - in my case the app was also not crashing, just not loading the files from cache and showing in the console the exception I originally posted. Seems like the exception was caught somewhere. |
My issue seems to be different that the one on the Parse Developers Google Group thread. I am not getting an NSException, but instead I receive the following error each and every time I try to load a PFFile image: [Error]: Response status code was unacceptable: 400 (Code: 1, Version: 1.9.1) |
Ok then I guess you should open a new issue. BTW, I got the error again, I will try to dump some data here... |
@nlutsenko should I move this off to a new thread? I started one a day ago. Issue #536 |
@nlutsenko you were right, the url is null.... What I'm doing is fetching the user in background to update all the fields. Then, when finished, doing a check like this:
In this particular case the PFFile is ok but the url is null - the above code outputs "user image url (null)". Although there IS a valid image stored on Parse side in that column. If this is normal then let me know how to get my image and feel free to close this issue. Thanks! |
@frangulyan Can you point me to the URL that you see on the server? |
@frangulyan, could you tell me the user objectId where you have this file attached? If you use the REST API via say, curl, - does it return a file field with |
Sure, the user id is IhfZepZ8SW, column "picture". I'm not familiar with REST API so I'm not sure that I will be able to make that request without some help :) |
@frangulyan The URL that you posted above is different from the one that is stored on Parse (that's still OK). Can you attach a repro project here, or send it to |
The thing is that after reinstalling the app the issue is usually gone. I just dumped the file attributes and got name='file' (which is not the file name on Parse) url='null' and 'isDirty'=1. One short clarification on the logic to understand if I'm doing it right. I'm doing fetchInBackgroundWithBlock on user and when it's done I'm taking its file column. Should I also fetch this file column to fill the info in that PFFile or fetching the user will bring everything needed to immediately call getDataInBackgroundWithBlock? |
Fetching the user should download all the fields for that user automatically, including all the required information for the file field. |
I just reinstalled the app (it's in simulator but I noticed similar stuff on the device) and the issue is gone. The file properties are name='tfss-b73775f4-660d-490a-942f-3491998082a5-profile.png' url='https://files.parsetfss.com/7c0e4c0f-b1b8-41c4-a38e-fc23addfe59f/tfss-b73775f4-660d-490a-942f-3491998082a5-profile.png' isDirty='0'. I guess sending a repro project will not help you since you will not be able to reproduce just like I cannot after the reinstall. But maybe creating a small project and being able to reproduce will work, if I would also send you some files and caches from apps directories. Anyway, I will get to it tomorrow, it's 3:30 AM in Germany and I need to wake up soon for work... Дуже дякую ;) |
Sounds good 😉 |
Hey Nikita, I'm terribly sorry, after digging and debugging for 3 hours it comes out to be my bug. What happens is that I fetch PFUser data which brings PFFile in one of the columns (user picture). Then I download it, use it in UI and everything is fine. But at some point I (wrongly) assign a new PFFile with same image data to that column (kind of user wants to upload a new picture):
After those lines the url becomes null - which I assume to be OK since the file is not yet uploaded to Parse. Then I guess sometimes I was doing some actions which were saving the whole user data (like changing email). Restarting the app was either crashing during a fetch try (if I didn't save before and the file was loaded from local data store with null url) or working normally (if I saved it before). Does this all make sense to you or it is still not the behaviour that you would expect and I missed something? Seems to me it's kind of dangerous to have newly created and not uploaded PFFiles between app runs, or I'm not following the best practices. P.S. when you said above that you see the image but under different path it should have been a signal for me that I'm saving the same image every time. I must have a lot of dangling files there, need to check and cleanup. |
Hey @frangulyan, that sounds about right. I am glad you were able to find the reason behind this. Not sure how you end up with an unsaved image on I would suggest adding a check for I still am curious on how you end up with an unsaved file on a currentUser() object, since we don't epxect this behavior for any given PFFile and it shouldn't happen. |
Ok I found a way to reproduce it and isolated in a small piece of code for you. I will send the test project to the email you mentioned above. |
I've sent it. Since it is the whole project including the frameworks it is a bit heavy - 17MB. Hopefully it will reach you without problems, let me know if you got it and are able to reproduce the issue. |
@frangulyan got the project, am able to reproduce an issue, turns out to be an absolutely valid way of doing this and it's indeed a bug in our code. Looking into ways to fix it... |
Multiple actionables:
Current workaround for your case: |
I will do that, I'm glad I could help! Also your support was amazing, thanks :) |
I'm getting this crash from time to time on app startup when trying to fetch user's profile image:
2015-11-08 13:23:15.088 MyApp[7219:471946] [Error]: Caught "NSInvalidArgumentException" with reason "*** -[_NSPlaceholderData initWithContentsOfFile:options:error:]: nil file argument":
(
0 CoreFoundation 0x0000000110a07f45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000011047edeb objc_exception_throw + 48
2 CoreFoundation 0x0000000110a07e7d +[NSException raise:format:] + 205
3 Foundation 0x000000011002cd48 -[NSData(NSData) initWithContentsOfFile:options:error:] + 95
4 Foundation 0x00000001100c5fcc +[NSData(NSData) dataWithContentsOfFile:options:error:] + 61
5 MyApp 0x000000010e828426 -[PFFile _cachedData] + 94
6 MyApp 0x000000010e886cac __62-[BFTask continueWithExecutor:successBlock:cancellationToken:]_block_invoke + 83
7 MyApp 0x000000010e88658c __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 82
8 MyApp 0x000000010e8874ab __29+[BFExecutor defaultExecutor]_block_invoke_2 + 358
9 MyApp 0x000000010e887a15 -[BFExecutor execute:] + 65
10 MyApp 0x000000010e886510 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 138
11 MyApp 0x000000010e886110 -[BFTask runContinuations] + 396
12 MyApp 0x000000010e8859c6 -[BFTask trySetResult:] + 151
13 MyApp 0x000000010e883c4c -[BFTaskCompletionSource trySetResult:] + 79
14 MyApp 0x000000010e7e48b3 __28-[PFAsyncTaskQueue enqueue:]_block_invoke_2 + 198
15 MyApp 0x000000010e88658c __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 82
16 libdispatch.dylib 0x00000001145fce5d _dispatch_call_block_and_release + 12
17 libdispatch.dylib 0x000000011461d49b _dispatch_client_callout + 8
18 libdispatch.dylib 0x0000000114605bef _dispatch_root_queue_drain + 1829
19 libdispatch.dylib 0x00000001146054c5 _dispatch_worker_thread3 + 111
20 libsystem_pthread.dylib 0x000000011494ea9d _pthread_wqthread + 729
21 libsystem_pthread.dylib 0x000000011494c3dd start_wqthread + 13
).
This seems to start happening after I recently updated the Parse SDK. Does this mean that file's cache is not somehow compatible with old cache or this is just a bug? Reinstalling the app has fixed it for now.
The text was updated successfully, but these errors were encountered: