Skip to content

Crash in InMemoryNormalizedCache's clear #3489

@postmechanical

Description

@postmechanical

Summary

SIGABRT crash due to Object 0x15ba38c80 of class _DictionaryStorage deallocated with non-zero retain count 2. This object's deinit, or something called from it, may have created a strong reference to self which outlived deinit, resulting in a dangling reference. when calling InMemoryNormalizedCache's clear method

Version

1.13.0

Steps to reproduce the behavior

Populate cache with some objects. Attempt to clear cache.

Logs

Crashed: com.apple.main-thread
0  libsystem_kernel.dylib         0xc1d4 __pthread_kill + 8
1  libsystem_pthread.dylib        0x7ef8 pthread_kill + 268
2  libsystem_c.dylib              0x77ad8 abort + 128
3  libswiftCore.dylib             0x3cc1a4 swift::fatalError(unsigned int, char const*, ...) + 134
4  libswiftCore.dylib             0x3cc1c4 swift::warningv(unsigned int, char const*, char*) + 30
5  libswiftCore.dylib             0x3d79ac swift_deallocPartialClassInstance + 306
6  libswiftCore.dylib             0x3d783c _swift_release_dealloc + 56
7  libswiftCore.dylib             0x3d8950 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1>>::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 160
8  App                            0x1c0a634 destroy for Record + 36 (<compiler-generated>:36)
9  libswiftCore.dylib             0x3b56fc swift_arrayDestroy + 196
10 libswiftCore.dylib             0xd2fac _DictionaryStorage.deinit + 540
11 libswiftCore.dylib             0xd3040 _DictionaryStorage.__deallocating_deinit + 16
12 libswiftCore.dylib             0x3d783c _swift_release_dealloc + 56
13 libswiftCore.dylib             0x3d8950 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1>>::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 160
14 libswiftCore.dylib             0xb5f00 Dictionary._Variant.removeAll(keepingCapacity:) + 100
15 App                            0x1c0b328 RecordSet.clear() + 27 (RecordSet.swift:27)
16 App                            0x1bed1c8 InMemoryNormalizedCache.clear() + 27 (InMemoryNormalizedCache.swift:27)
17 App                            0x165f688 ResponsiveInMemoryNormalizedCache.clear() + 36 (ResponsiveInMemoryNormalizedCache.swift:36)
18 App                            0x165f6d0 ResponsiveInMemoryNormalizedCache.didReceiveMemoryWarning() + 40 (ResponsiveInMemoryNormalizedCache.swift:40)
19 App                            0x165f728 @objc ResponsiveInMemoryNormalizedCache.didReceiveMemoryWarning() + 36 (<compiler-generated>:36)
20 CoreFoundation                 0x512f4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
21 CoreFoundation                 0x51210 ___CFXRegistrationPost_block_invoke + 88
22 CoreFoundation                 0x51158 _CFXRegistrationPost + 436
23 CoreFoundation                 0x4f70c _CFXNotificationPost + 728
24 Foundation                     0x2fea4 -[NSNotificationCenter postNotificationName:object:userInfo:] + 92
25 UIKitCore                      0x1147b60 -[UIApplication _performMemoryWarning] + 128
26 UIKitCore                      0x1147cf4 -[UIApplication _receivedMemoryNotification] + 128
27 libdispatch.dylib              0x40d0 _dispatch_client_callout + 20
28 libdispatch.dylib              0x7580 _dispatch_continuation_pop + 596
29 libdispatch.dylib              0x1b53c _dispatch_source_latch_and_call + 420
30 libdispatch.dylib              0x1a104 _dispatch_source_invoke + 836
31 libdispatch.dylib              0x128f4 _dispatch_main_queue_drain + 744
32 libdispatch.dylib              0x125fc _dispatch_main_queue_callback_4CF + 44
33 CoreFoundation                 0x56204 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
34 CoreFoundation                 0x53440 __CFRunLoopRun + 1996
35 CoreFoundation                 0x52830 CFRunLoopRunSpecific + 588
36 GraphicsServices               0x11c4 GSEventRunModal + 164
37 UIKitCore                      0x3d2eb0 -[UIApplication _run] + 816
38 UIKitCore                      0x4815b4 UIApplicationMain + 340
39 App                            0x133ca0 main + 17 (AppDelegate.swift:17)
40 ???                            0x1b9356ec8 (Missing)

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions