Closed danielcompton closed 2 years ago
I’ve seen some hangs too, though not this exact one. Thanks for the report.
I'm having lots of hangs with the same stack as @danielcompton:
Sampling process 49627 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Quicksilver (pid 49627) every 1 millisecond
Process: Quicksilver [49627]
Path: /Applications/Quicksilver.app/Contents/MacOS/Quicksilver
Load Address: 0x10dc4c000
Identifier: com.blacktree.Quicksilver
Version: 1.4.2 (401A)
Code Type: X86-64
Parent Process: ??? [1]
Date/Time: 2016-11-11 21:33:11.978 -0800
Launch Time: 2016-11-11 16:22:03.989 -0800
OS Version: Mac OS X 10.12 (16A323)
Report Version: 7
Analysis Tool: /usr/bin/sample
----
Call graph:
2617 Thread_3732905 DispatchQueue_1: com.apple.main-thread (serial)
2617 start (in libdyld.dylib) + 1 [0x7fffc4380255]
2617 NSApplicationMain (in AppKit) + 1237 [0x7fffacf97a8a]
2617 -[NSApplication run] (in AppKit) + 926 [0x7fffacfccfbd]
2617 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit) + 1637 [0x7fffad6e88eb]
2617 _DPSNextEvent (in AppKit) + 1093 [0x7fffacfd85f5]
2617 _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox) + 71 [0x7fffae8e1bd6]
2617 ReceiveNextEventCommon (in HIToolbox) + 184 [0x7fffae8e1ca9]
2617 RunCurrentEventLoopInMode (in HIToolbox) + 240 [0x7fffae8e1f6c]
2617 CFRunLoopRunSpecific (in CoreFoundation) + 420 [0x7fffaf3405b4]
2617 __CFRunLoopRun (in CoreFoundation) + 917 [0x7fffaf340ba5]
2617 __CFRunLoopDoBlocks (in CoreFoundation) + 356 [0x7fffaf341424]
2617 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ (in CoreFoundation) + 12 [0x7fffaf3603ac]
2617 ___LSScheduleNotificationFunction_block_invoke_2 (in LaunchServices) + 51 [0x7fffb04f1715]
2617 HIToolboxLSNotificationCallbackAllASNsFunc (in HIToolbox) + 571 [0x7fffae94b43e]
2617 SendEventToEventTargetWithOptions (in HIToolbox) + 43 [0x7fffae8b918f]
2617 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) (in HIToolbox) + 428 [0x7fffae8b9346]
2617 DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) (in HIToolbox) + 1708 [0x7fffae8ba0d5]
2617 appLaunched (in QSCore) + 176 [0x10dd731ba]
2617 -[NSNotificationCenter postNotificationName:object:userInfo:] (in Foundation) + 66 [0x7fffb0d220e3]
2617 _CFXNotificationPost (in CoreFoundation) + 604 [0x7fffaf3129dc]
2617 -[_CFXNotificationRegistrar find:object:observer:enumerator:] (in CoreFoundation) + 1827 [0x7fffaf3139a3]
2617 ___CFXNotificationPost_block_invoke (in CoreFoundation) + 50 [0x7fffaf3562a2]
2617 _CFXRegistrationPost (in CoreFoundation) + 427 [0x7fffaf35653b]
2617 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ (in CoreFoundation) + 12 [0x7fffaf35663c]
2617 -[QSProcessMonitor addProcessWithPSN:] (in QSCore) + 393 [0x10dd74074]
2617 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] (in Foundation) + 118 [0x7fffb0d2d536]
2617 NSKeyValueDidChange (in Foundation) + 486 [0x7fffb0d5e654]
2617 NSKeyValueNotifyObserver (in Foundation) + 350 [0x7fffb0d5edbd]
2617 -[QSProcessObjectSource observeValueForKeyPath:ofObject:change:context:] (in QSCore) + 110 [0x10dd75de4]
2617 -[QSProcessObjectSource invalidateSelf] (in QSCore) + 75 [0x10dd75e42]
2617 -[QSObjectSource invalidateSelf] (in QSCore) + 104 [0x10dd66bcb]
2617 -[NSNotificationCenter postNotificationName:object:userInfo:] (in Foundation) + 66 [0x7fffb0d220e3]
2617 _CFXNotificationPost (in CoreFoundation) + 604 [0x7fffaf3129dc]
2617 -[_CFXNotificationRegistrar find:object:observer:enumerator:] (in CoreFoundation) + 1827 [0x7fffaf3139a3]
2617 ___CFXNotificationPost_block_invoke (in CoreFoundation) + 50 [0x7fffaf3562a2]
2617 _CFXRegistrationPost (in CoreFoundation) + 427 [0x7fffaf35653b]
2617 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ (in CoreFoundation) + 12 [0x7fffaf35663c]
2617 -[QSLibrarian reloadSource:] (in QSCore) + 428 [0x10dd4ada2]
2617 -[QSCatalogEntry scanForced:] (in QSCore) + 403 [0x10dd3ec99]
2617 -[QSCatalogEntry indexIsValid] (in QSCore) + 187 [0x10dd3e65f]
2617 _dispatch_barrier_sync_f_slow (in libdispatch.dylib) + 402 [0x7fffc43555ea]
2617 _dispatch_thread_event_wait_slow (in libdispatch.dylib) + 85 [0x7fffc4362c6e]
2617 _dispatch_ulock_wait (in libdispatch.dylib) + 40 [0x7fffc4362a8e]
2617 __ulock_wait (in libsystem_kernel.dylib) + 10 [0x7fffc44af3b6]
QSProcessObjectSource
is updated whenever an application launches or quits. Much more often than most sources, in other words. I think I know what’s happening, but I can’t say why.
If you can reproduce it fairly easily, I could send a custom build with extra logging.
This probably isn't the right fix, and I can't seem to see where the hang is coming from, but it's horrible that all that process scanning is happening on the main thread. We still have an issue that trying to run catalog entry scans on a dedicated thread for that catalog entry can still cause a deadlock, figuring out where it's coming from though is not easy.
Here's my small proposal: https://github.com/quicksilver/Quicksilver/commit/60c98bed167aefb3071ccf4d0e408e2a87858ef6
I'm reproducing several times a day @skurfer... in the minutes to hours timeframe. I'd be happy to capture logs if that'll help. Let me know.
This probably isn't the right fix, and I can't seem to see where the hang is coming from, but it's horrible that all that process scanning is happening on the main thread.
I assumed the hang was happening when the scanning and checking indexIsValid
were happening at the same time (which shouldn’t be possible), but if that’s on a background thread, it shouldn’t lock up the UI, right? So maybe that’s not it. But the only thing happening on the main thread is a quick boolean test, so… No idea.
If you go through the stack trace, it’s the main thread that listening for changes in QSProcessMonitor then instructing the QSCatalogEntry (via NSNotifications) to do some scanning. The only point it gets off the main thread is when dispatch_sync() is called - but of course, since it’s dispatch_sync and not dispatch_async then it’s still the main thread that’s hanging.
I’d suggest building with my changes and getting j3r3miah to test it out.
On 18 Nov 2016, at 06:42, Rob McBroom notifications@github.com wrote:
This probably isn't the right fix, and I can't seem to see where the hang is coming from, but it's horrible that all that process scanning is happening on the main thread.
I assumed the hang was happening when the scanning and checking indexIsValid were happening at the same time (which shouldn’t be possible), but if that’s on a background thread, it shouldn’t lock up the UI, right? So maybe that’s not it. But the only thing happening on the main thread is a quick boolean test, so… No idea.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/quicksilver/Quicksilver/issues/2279#issuecomment-261393408, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJLn9iQG-0ZPVsB3mzwP26UGOh-OOqWks5q_NhqgaJpZM4KQmHF.
I’d suggest building with my changes and getting j3r3miah to test it out.
OK, see if this is any better @j3r3miah.
Thanks for the build @skurfer. I'll give it a try but I likely won't have results for you for more than a week, as I've been traveling and noticed the issue hasn't come up once since I left home. I suspect the problem may be related to scanning network volumes (on my home network). Anyway, I'll run the potentially-fixed-build when I'm home in a week and see what happens.
Frustratingly, I'm no longer reproducing the issue with the 1.4.2 so I can't say whether the above change had any impact. I'm not sure what changed.
Btw, https://qsapp.com/download.php is still pointing to 1.4.2
Btw, https://qsapp.com/download.php is still pointing to 1.4.2
It was marked as a pre-release, but I forgot and updated the text on the download page. I’ll go ahead and make it a real release. Thanks for pointing it out.
I started seeing QS hang on login pretty reliably yesterday (probably due to other changes I’m running with). It was getting stuck on addProcessWithPSN:
, but your fix didn’t help @pjrobertson since it was getting called from appLaunched:
. So I reverted your change and instead just wrapped the didChange…
and postNotification
calls at the end of the add/remove process methods. Opinions?
should NSNotifications be called on anything but the main thread? (edit: yes it's fine to call notifs on a background thread )
The most important thing is to make sure that the receiver (whoever is listening to QSEventNotification
and all those KVO bindings) now knows that they're running on a background thread (since if you post from a background thread, the receiver gets that message on the same thread). This could be a problem if for example the receiver of QSEventNotification
needs to do something with NSView/the UI which must be run on a foreground thread.
Closing this. @danielcompton If we're still getting hangs on the latest version, then please re-open and we can debug further.
I've been getting hangs from Quicksilver since upgrading to Sierra. Here's the full gist.