Automattic / Automattic/simplenote-macos

Thread hang risk

Open
#1,104 0 comments 0 reactions 0 assignees View on GitHub
[Type] Bug bug
Dominant language
Swift
Stars
1.6k
Forks
172
Avg merge
11h 17m
Merged PRs (30d)
3

Description

I bumped into this while running 2.19 https://github.com/Automattic/simplenote-macos/pull/1103 from Xcode.

image

```
Thread Performance Checker: Thread running at QOS_CLASS_USER_INTERACTIVE waiting on a lower QoS thread running at QOS_CLASS_DEFAULT. Investigate ways to avoid priority inversions
PID: 18748, TID: 7522316
Backtrace
=================================================================
3 Simperium_OSX 0x00000001037c5dd4 -[_SPRRunLoopThread runLoop] + 44
4 Simperium_OSX 0x00000001037c5b18 __45+[NSRunLoop(SPRWebSocket) SPR_networkRunLoop]_block_invoke + 124
5 libdispatch.dylib 0x00000001033d699c _dispatch_client_callout + 20
6 libdispatch.dylib 0x00000001033d88bc _dispatch_once_callout + 160
7 Simperium_OSX 0x00000001037c5a74 +[NSRunLoop(SPRWebSocket) SPR_networkRunLoop] + 88
8 Simperium_OSX 0x00000001037bf544 -[SPRWebSocket openConnection] + 76
9 Simperium_OSX 0x00000001037be250 -[SPRWebSocket open] + 240
10 Simperium_OSX 0x00000001037c9904 -[SPWebSocket open] + 76
11 Simperium_OSX 0x00000001037d3e08 -[SPWebSocketInterface openWebSocket] + 672
12 Simperium_OSX 0x00000001037d3f50 -[SPWebSocketInterface start:] + 268
13 Simperium_OSX 0x0000000103776eac -[Simperium startNetworkManagers] + 992
14 Simperium_OSX 0x000000010377b1a0 -[Simperium authenticationDidSucceedForUsername:token:] + 72
15 Simperium_OSX 0x0000000103785c28 -[SPAuthenticator authenticateIfNecessary] + 1960
16 Simperium_OSX 0x000000010377b580 -[Simperium authenticateIfNecessary] + 260
17 Simperium_OSX 0x0000000103778670 -[Simperium startWithAppID:APIKey:] + 592
18 Simperium_OSX 0x0000000103778294 -[Simperium authenticateWithAppID:APIKey:window:] + 304
19 Simplenote 0x0000000102a812fc -[SimplenoteAppDelegate applicationWillFinishLaunching:] + 364
20 CoreFoundation 0x0000000183f1b180 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
21 CoreFoundation 0x0000000183fb6eec ___CFXRegistrationPost_block_invoke + 88
22 CoreFoundation 0x0000000183fb6e34 _CFXRegistrationPost + 440
23 CoreFoundation 0x0000000183eec4cc _CFXNotificationPost + 704
24 Foundation 0x0000000184e4a8f4 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
25 AppKit 0x0000000187139584 -[NSApplication finishLaunching] + 248
26 AppKit 0x0000000187139270 -[NSApplication run] + 252
27 AppKit 0x0000000187110794 NSApplicationMain + 880
28 Simplenote 0x0000000102a81040 main + 36
29 dyld 0x0000000183aeff28 start + 2236
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the warning by running version 2.19 from Xcode, then trace the startup path from SimplenoteAppDelegate applicationWillFinishLaunching: through Simperium startNetworkManagers and SPWebSocketInterface start:. Inspect SPRWebSocket openConnection and the SPR_networkRunLoop creation shown in the backtrace. Done means the reported priority-inversion or thread-hang risk is resolved and the warning no longer appears during launch.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.