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

MJ_LOCK 造成线程优先级倒置 #861

Open
winterrain5 opened this issue Apr 9, 2024 · 1 comment
Open

MJ_LOCK 造成线程优先级倒置 #861

winterrain5 opened this issue Apr 9, 2024 · 1 comment

Comments

@winterrain5
Copy link

Thread Performance Checker: Thread running at User-interactive quality-of-service class waiting on a lower QoS thread running at Default quality-of-service class. Investigate ways to avoid priority inversions
PID: 1124, TID: 45004
Backtrace

3 MJExtension 0x0000000105d89828 -[MJProperty objectClassInArrayForClass:] + 112
4 MJExtension 0x0000000105d8cb28 __48-[NSObject(MJKeyValue) mj_setKeyValues:context:]_block_invoke + 1652
5 MJExtension 0x0000000105d91024 +[NSObject(Property) mj_enumerateProperties:] + 292
6 MJExtension 0x0000000105d8c378 -[NSObject(MJKeyValue) mj_setKeyValues:context:] + 660
7 MJExtension 0x0000000105d8c0b8 -[NSObject(MJKeyValue) mj_setKeyValues:] + 72
8 MJExtension 0x0000000105d8dd40 +[NSObject(MJKeyValue) mj_objectWithKeyValues:context:] + 528
9 MJExtension 0x0000000105d8ce40 __48-[NSObject(MJKeyValue) mj_setKeyValues:context:]_block_invoke + 2444
10 MJExtension 0x0000000105d91024 +[NSObject(Property) mj_enumerateProperties:] + 292
11 MJExtension 0x0000000105d8c378 -[NSObject(MJKeyValue) mj_setKeyValues:context:] + 660
12 MJExtension 0x0000000105d8c0b8 -[NSObject(MJKeyValue) mj_setKeyValues:] + 72
13 MJExtension 0x0000000105d8dd40 +[NSObject(MJKeyValue) mj_objectWithKeyValues:context:] + 528
14 MJExtension 0x0000000105d8ce40 __48-[NSObject(MJKeyValue) mj_setKeyValues:context:]_block_invoke + 2444
15 MJExtension 0x0000000105d91024 +[NSObject(Property) mj_enumerateProperties:] + 292
16 MJExtension 0x0000000105d8c378 -[NSObject(MJKeyValue) mj_setKeyValues:context:] + 660
17 MJExtension 0x0000000105d8c0b8 -[NSObject(MJKeyValue) mj_setKeyValues:] + 72
18 MJExtension 0x0000000105d8dd40 +[NSObject(MJKeyValue) mj_objectWithKeyValues:context:] + 528
19 MJExtension 0x0000000105d8e368 +[NSObject(MJKeyValue) mj_objectArrayWithKeyValuesArray:context:] + 708
20 MJExtension 0x0000000105d8e078 +[NSObject(MJKeyValue) mj_objectArrayWithKeyValuesArray:] + 72
21 Wecyn 0x00000001030d8ce4 __74-[OIMManager(Conversation) getAllConversationListWithOnSuccess:onFailure:]_block_invoke + 96
22 Wecyn 0x00000001030c9ecc __27-[CallbackProxy onSuccess:]_block_invoke + 80
23 Wecyn 0x00000001030c9ff8 __36-[CallbackProxy dispatchMainThread:]_block_invoke + 40
24 libdispatch.dylib 0x0000000108130f50 _dispatch_call_block_and_release + 32
25 libdispatch.dylib 0x0000000108132b34 _dispatch_client_callout + 20
26 libdispatch.dylib 0x0000000108142fec _dispatch_main_queue_drain + 1084
27 libdispatch.dylib 0x0000000108142ba0 _dispatch_main_queue_callback_4CF + 44
28 CoreFoundation 0x00000001ab444f9c 5A6C1F41-BF70-32F6-A1D6-5B894DD21362 + 225180
29 CoreFoundation 0x00000001ab441ca8 5A6C1F41-BF70-32F6-A1D6-5B894DD21362 + 212136
30 CoreFoundation 0x00000001ab4413f8 CFRunLoopRunSpecific + 608
31 GraphicsServices 0x00000001ee9cf4f8 GSEventRunModal + 164
32 UIKitCore 0x00000001ad8678a0 2D538446-6E40-3C10-8A5F-559C938077A0 + 2279584
33 UIKitCore 0x00000001ad866edc UIApplicationMain + 340
34 Wecyn 0x00000001023059c0 main + 64
35 dyld 0x00000001ce196dcc 28D6D2C1-46CE-3D58-B744-B06A6C573888 + 24012

运行环境

  • iPhoneSE 2
  • iOS 17.2
  • Xcode 14
  • MJExtension: 3.4.2
@winterrain5
Copy link
Author

问题发生的代码块:

  • (Class)objectClassInArrayForClass:(Class)c
    {
    NSString *key = NSStringFromClass(c);
    if (!key) return nil;

    MJ_LOCK(self.objectClassInArrayLock);
    Class objectClass = self.objectClassInArrayDict[key];
    MJ_UNLOCK(self.objectClassInArrayLock);
    return objectClass;
    }

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

No branches or pull requests

1 participant