element-hq / element-hq/element-ios

Crash in URLPreviewStore.preview(for:and:)

Open
#5,173 2 comments 0 reactions 0 assignees View on GitHub
A-Timeline crash O-Uncommon S-Major T-Defect
Dominant language
Swift
Stars
1.8k
Forks
544
PR merge metrics
PR metrics pending

Description

In 1.6.8, we can see:

```
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000574323030
VM Region Info: 0x574323030 is not in any region. Bytes after previous region: 12149993521 Bytes before following region: 44221452240
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
MALLOC_NANO 280000000-2a0000000 [512.0M] rw-/rwx SM=COW
---> GAP OF 0xd20000000 BYTES
commpage (reserved) fc0000000-1000000000 [ 1.0G] ---/--- SM=NUL ...(unallocated)

Triggered by Thread: 18

Last Exception Backtrace:
0 CoreFoundation 0x1a2593928 __exceptionPreprocess + 216 (NSException.m:199)
1 libobjc.A.dylib 0x1b6332480 objc_exception_throw + 56 (objc-exception.mm:565)
2 CoreFoundation 0x1a2495288 +[NSException raise:format:] + 108 (NSException.m:155)
3 MatrixSDK 0x10685fc88 0x10675c000 + 1064072
4 libsystem_platform.dylib 0x1eaa30d9c _sigtramp + 52 (sigtramp.c:116)
5 CoreData 0x1a839a308 _PF_Handler_Public_GetProperty + 224 (NSManagedObject.m:311)
6 Foundation 0x1a378f544 -[NSFunctionExpression expressionValueWithObject:context:] + 676 (NSFunctionExpression.m:233)
7 Foundation 0x1a378f1c4 -[NSComparisonPredicate evaluateWithObject:substitutionVariables:] + 212 (NSComparisonPredicate.m:295)
8 Foundation 0x1a3790e4c -[NSCompoundPredicateOperator evaluatePredicates:withObject:substitutionVariables:] + 268 (NSCompoundPredicateOperator.m:91)
9 Foundation 0x1a3790cb4 -[NSCompoundPredicate evaluateWithObject:substitutionVariables:] + 244 (NSCompoundPredicate.m:274)
10 CoreData 0x1a82868cc -[NSManagedObjectContext executeFetchRequest:error:] + 2900 (NSManagedObjectContext.m:2305)
11 libswiftCoreData.dylib 0x1ea769388 NSManagedObjectContext.fetch(_:) + 64 (NSManagedObjectContext.swift:18)
12 Riot 0x102fde48c URLPreviewStore.preview(for:and:) + 792 (URLPreviewStore.swift:104)
13 Riot 0x102fdbe54 URLPreviewService.preview(for:and:with:success:failure:) + 152 (URLPreviewService.swift:57)
14 Riot 0x102fdc4d8 @objc URLPreviewService.preview(for:and:with:success:failure:) + 272 (:0)
15 Riot 0x102cf3798 -[RoomBubbleCellData refreshURLPreviewForEventId:] + 812 (RoomBubbleCellData.m:1105)
16 Riot 0x102cefe18 0x102c1c000 + 867864
17 MatrixKit 0x10648f398 __41-[MXKRoomDataSource processQueuedEvents:]_block_invoke + 2136 (MXKRoomDataSource.m:3098)
18 libdispatch.dylib 0x1a21ca2b0 _dispatch_call_block_and_release + 24 (init.c:1466)
19 libdispatch.dylib 0x1a21cb298 _dispatch_client_callout + 16 (object.m:559)
20 libdispatch.dylib 0x1a21a7344 _dispatch_lane_serial_drain$VARIANT$armv81 + 568 (inline_internal.h:2557)
21 libdispatch.dylib 0x1a21a7e2c _dispatch_lane_invoke$VARIANT$armv81 + 400 (queue.c:3862)
22 libdispatch.dylib 0x1a21b166c _dispatch_workloop_worker_thread + 692 (queue.c:6589)
23 libsystem_pthread.dylib 0x1eaa415bc _pthread_wqthread + 272 (pthread.c:2436)
24 libsystem_pthread.dylib 0x1eaa4486c start_wqthread + 8

Contributor guide

Open the contributing guide

Research direction

Start at URLPreviewStore.swift:104, where the crash occurs during the Core Data fetch, then trace the call from URLPreviewService.swift:57 and RoomBubbleCellData.m:1105. Reproduce URL preview loading while inspecting the fetch and its predicate, and verify that previews no longer crash on the reported flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.