Open jkmassel opened 4 years ago
@diegoreymendez @frosty @guarani, another nil is not a valid object ID
this time in MediaProgressCoordinator
. 😢
@bummytime would you like to assign this one since you marked it as high priority and it's a new crash? Alternately, you could de-escalate it if you feel the important Media issues already have attention right now.
Events in the last 90d: 202 Users affected in the last 90d: 127 WORDPRESS-IOS-38VR: https://sentry.io/share/issue/e8f83bc0ac2648e696b58ada13f6e31b/
FWIW, I had a look at this earlier today and I think it could be related to https://github.com/wordpress-mobile/WordPress-iOS/issues/14960. Both are due to blog.objectID
being nil
albeit in different areas of media-related code.
I managed to reproduce the issue.
These modifications are used to force the specific situation in which media.blog
is NULL, while only affecting the part of the code we want to crash (by instead using daBlog
.
Add this to Media.h
:
@property (nonatomic, strong, readonly) Blog *daBlog;
Add this to Media.m
:
- (Blog *)daBlog
{
return NULL;
}
Change line 167 of MediaProgressCoordinatorNoticeViewModel.swift
to:
var blog = media.daBlog
The symbols are a bit off for me (not sure why) but it's crashing in the exact same spot with the exact same message:
2020-10-01 11:11:55.319878-0300 WordPress[71994:812930] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'nil is not a valid object ID'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff2043a126 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff20177f78 objc_exception_throw + 48
2 CoreData 0x00007fff250f9b08 -[NSFaultHandler fulfillFault:withContext:error:] + 0
3 WordPress 0x0000000108aad107 $s9WordPress39MediaProgressCoordinatorNoticeViewModelV13blogInContext33_027770C62B8AC1DD8D3D2271DD2F4928LLSo4BlogCSgvg + 1239
4 WordPress 0x0000000108aab627 $s9WordPress39MediaProgressCoordinatorNoticeViewModelV07successF033_027770C62B8AC1DD8D3D2271DD2F4928LLAA0F0Vvg + 199
5 WordPress 0x0000000108aab53d $s9WordPress39MediaProgressCoordinatorNoticeViewModelV6noticeAA0F0VSgvg + 141
6 WordPress 0x0000000109040f8b $s9WordPress16MediaCoordinatorC013mediaProgressD15DidFinishUploadyyAA0cfD0CF + 1291
7 WordPress 0x0000000109041df4 $s9WordPress16MediaCoordinatorC013mediaProgressD15DidFinishUploadyyAA0cfD0CFTo + 68
8 WordPress 0x000000010917bf9e $s9WordPress24MediaProgressCoordinatorC07refreshcD033_E4E6231F30812010CC2D864A8028052BLLyyF + 334
9 WordPress 0x000000010917bb0b $s9WordPress24MediaProgressCoordinatorC12observeValue10forKeyPath2of6change7contextySSSg_ypSgSDySo05NSKeyg6ChangeI0aypGSgSvSgtFyycfU_ + 27
10 WordPress 0x00000001082b84a0 $sIeg_IeyB_TR + 48
11 libdispatch.dylib 0x00000001102f58ac _dispatch_call_block_and_release + 12
12 libdispatch.dylib 0x00000001102f6a88 _dispatch_client_callout + 8
13 libdispatch.dylib 0x0000000110304f23 _dispatch_main_queue_callback_4CF + 1152
14 CoreFoundation 0x00007fff203a8276 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
15 CoreFoundation 0x00007fff203a2b06 __CFRunLoopRun + 2685
16 CoreFoundation 0x00007fff203a1b9e CFRunLoopRunSpecific + 567
17 GraphicsServices 0x00007fff2b773db3 GSEventRunModal + 139
18 UIKitCore 0x00007fff24660af3 -[UIApplication _run] + 912
19 UIKitCore 0x00007fff24665a04 UIApplicationMain + 101
20 WordPress 0x0000000108fb7734 main + 500
21 libdyld.dylib 0x00007fff20257415 start + 1
22 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'nil is not a valid object ID'
terminating with uncaught exception of type NSException
CoreSimulator 732.17 - Device: iPhone 11 (1C390606-1277-4665-8DC6-27745C3935D4) - Runtime: iOS 14.0 (18A372) - DeviceType: iPhone 11
Current impact: First Release: 15.3.0.3; 153 Users (5-20 events/day). I am removing the high-pri status from this issue. We will potentially add this issue to a "Media improvements" project starting in the near term.
The crashing code is from the backtrace is:
Some notes:
blogInContext
for the blog
object, but the media
object is accessed directly without checking what context it belongs to, or whether that context is appropriate for the current thread. According to CoreData's documentation, accessing media.blog
is not safe if the context does not belong to the current thread.blog.managedObjectContext != mainContext
. Therefore the media
object was not created in the main thread either. Following this logic we can also deduce that the media object was NOT created here (since the service instantiated here uses the main context) https://github.com/wordpress-mobile/WordPress-iOS/blob/develop/WordPress/Classes/Services/MediaCoordinator.swift#L160.@diegoreymendez looks like your PR knocked out https://github.com/wordpress-mobile/WordPress-iOS/issues/14960 but #14963 shows an increase in issues instead. Would you mind taking a quick look to see if anything stands out and then help let me know an estimate of time that you think it would take in order to investigate this one further? I feel it seems tricky since you already had one go at fixing it and the documentation of the steps to reproduce and the PR looked good to me. 🤔
Events in the last 90d: 1,100 Users affected in the last 90d: 729 WORDPRESS-IOS-38VR: https://sentry.io/share/issue/e8f83bc0ac2648e696b58ada13f6e31b/
This issue has been marked as stale because:
[Pri] Blocker
, [Pri] High
, or good first issue
.Please comment with an update if you believe this issue is still valid or if it can be closed. This issue will also be reviewed for validity and priority during regularly scheduled triage sessions.
Sentry Url: https://sentry.io/share/issue/e8f83bc0ac2648e696b58ada13f6e31b/ User Count: 93 Count: 149 First Release: 15.3.0.3 First Seen: 2020-08-18T21:08:38Z Last Seen: 2020-09-21T18:02:10Z 24 Hours: 3 30 Days: 148 LogID: BA1FBB6A-00EE-41B8-A189-757FD8A38A22