Skip to content
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

SDWebImageSwiftUI, Crash ImagePlayer.__deallocating_deinit + 33 (ImagePlayer.swift:33) #281

Closed
zs40x opened this issue Nov 13, 2023 · 4 comments · Fixed by #287
Closed

Comments

@zs40x
Copy link

zs40x commented Nov 13, 2023

XCode 13
iOS 17.1.1, iOS 17.0.3
SDWebImage: 5.18.4
SDWebImageSwiftUI: 2.2.4

Hello, I have been observing a crash for weeks, which occurs sporadically even after updating the SDWebimage components to the latest version. I have not yet found a way to reproduce the error.

Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0xa01c __pthread_kill + 8
1 libsystem_pthread.dylib 0x5680 pthread_kill + 268
2 libsystem_c.dylib 0x75b90 abort + 180
3 libswiftCore.dylib 0x3a24d8 swift::fatalError(unsigned int, char const*, ...) + 126
4 libswiftCore.dylib 0x3a24f8 swift::warningv(unsigned int, char const*, char*) + 30
5 libswiftCore.dylib 0x3a2afc swift_beginAccess + 534
6 libswiftCore.dylib 0x3a2b50 swift_beginAccess + 84
7 SwiftUI 0x1794ab8 OUTLINED_FUNCTION_2 + 14568
8 SwiftUI 0x18e6150 OUTLINED_FUNCTION_9 + 17348
9 SwiftUI 0x266998 OUTLINED_FUNCTION_0 + 7160
10 SwiftUI 0x2667b8 OUTLINED_FUNCTION_0 + 6680
11 SwiftUI 0x26711c OUTLINED_FUNCTION_0 + 9084
12 SwiftUI 0x1ba3ae8 OUTLINED_FUNCTION_7 + 11120
13 Combine 0x3dc98 ObservableObjectPublisher.Inner.send() + 212
14 Combine 0x3db44 ObservableObjectPublisher.send() + 596
15 Combine 0x41bc PublishedSubject.send(_:) + 260
16 Combine 0x2c70 static Published.subscript.setter + 420
17 0x1a4ba4 ImagePlayer.__deallocating_deinit + 33 (ImagePlayer.swift:33)
18 libswiftCore.dylib 0x3a6d88 _swift_release_dealloc + 56
19 libswiftCore.dylib 0x3a8424 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 136
20 0x1adefc objectdestroy.30Tm + 4366982908
21 libswiftCore.dylib 0x3a6d88 _swift_release_dealloc + 56
22 libswiftCore.dylib 0x3a8424 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 136
23 AttributeGraph 0x241c0 AG::Node::destroy(AG::Graph&) + 156
24 AttributeGraph 0x1e540 AG::Subgraph::invalidate_now(AG::Graph&) + 1236
25 AttributeGraph 0x9d50 AG::Graph::invalidate_subgraphs() + 196
26 AttributeGraph 0x18534 AG::Graph::Context::~Context() + 352
27 AttributeGraph 0x2bc34 AGGraphInvalidate + 36
28 SwiftUI 0x1794218 OUTLINED_FUNCTION_2 + 12360
29 SwiftUI 0x18ebff0 OUTLINED_FUNCTION_9 + 41572
30 SwiftUI 0x18ebeec OUTLINED_FUNCTION_9 + 41312
31 SwiftUI 0x18ec020 OUTLINED_FUNCTION_9 + 41620
32 SwiftUI 0x18f79ac OUTLINED_FUNCTION_140 + 16956
33 libobjc.A.dylib 0x5354 object_cxxDestructFromClass(objc_object*, objc_class*) + 116
34 libobjc.A.dylib 0x5090 objc_destructInstance + 80
35 libobjc.A.dylib 0x503c _objc_rootDealloc + 80
36 UIKitCore 0x7ff70 -[UIResponder dealloc] + 124
37 UIKitCore 0x2abf04 -[UIViewController dealloc] + 1172
38 SwiftUI 0x115a34c OUTLINED_FUNCTION_2 + 12888
39 SwiftUI 0x1157f0c OUTLINED_FUNCTION_2 + 3608
40 SwiftUI 0x1158f98 OUTLINED_FUNCTION_2 + 7844
41 SwiftUI 0x1158d90 OUTLINED_FUNCTION_2 + 7324
42 SwiftUI 0x1158b70 OUTLINED_FUNCTION_2 + 6780
43 SwiftUI 0x13802b0 OUTLINED_FUNCTION_8 + 1872
44 SwiftUI 0x79d710 OUTLINED_FUNCTION_101 + 528
45 SwiftUI 0xe06b40 OUTLINED_FUNCTION_15 + 28628
46 SwiftUI 0xe06360 OUTLINED_FUNCTION_15 + 26612
47 SwiftUI 0x187f3d8 OUTLINED_FUNCTION_2 + 20040
48 SwiftUI 0x187cd18 OUTLINED_FUNCTION_2 + 10120
49 SwiftUI 0x18ed094 OUTLINED_FUNCTION_9 + 45832
50 SwiftUI 0x18ed0f4 OUTLINED_FUNCTION_9 + 45928
51 UIKitCore 0x32694 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1528
52 QuartzCore 0x671c0 CA::Layer::layout_if_needed(CA::Transaction*) + 500
53 QuartzCore 0x66d48 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 144
54 QuartzCore 0x6d278 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 464
55 QuartzCore 0x66574 CA::Transaction::commit() + 648
56 QuartzCore 0x6621c CA::Transaction::flush_as_runloop_observer(bool) + 88
57 CoreFoundation 0x35a2c CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 36
58 CoreFoundation 0x34434 __CFRunLoopDoObservers + 548
59 CoreFoundation 0x33b50 __CFRunLoopRun + 1028
60 CoreFoundation 0x33668 CFRunLoopRunSpecific + 608
61 GraphicsServices 0x35ec GSEventRunModal + 164
62 UIKitCore 0x22c2b4 -[UIApplication _run] + 888
63 UIKitCore 0x22b8f0 UIApplicationMain + 340
64 0x78444 main + 14 (AppDelegate.swift:14)
65 ??? 0x1b7512dcc (Fehlt)

@eeallen1
Copy link

I've been seeing this as well, in ImagePlayer.deinit

* thread #1, queue = 'com.apple.main-thread', stop reason = Simultaneous accesses to 0x11b2c4b10, but modification requires exclusive access

Seems there's some fatal access conflict. I can reproduce it, but not reliably. It accounts for several thousand crashes per week in my app, but so far I haven't been able to find a solution

@dreampiggy
Copy link
Collaborator

I guess this is the same as #202

@dreampiggy
Copy link
Collaborator

A quick fix it's to remove the imagePlayer.stopPlaying, or simple, do not trigger the Combine publisher when deallocating

dreampiggy added a commit that referenced this issue Dec 13, 2023
dreampiggy added a commit that referenced this issue Dec 13, 2023
…publisher

Try to workaround the #281 when imagePlayer stopPlaying trigger the Combine Publisher during deallocating
@dreampiggy
Copy link
Collaborator

Try with v2.2.6 and see whether this been fixed or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants