Closed Thalagyrt closed 9 years ago
Possibly related to #109? I tried replicating the problem by unplugging and replugging the keyboard a few times but so far nothing unusual has happened. Can you narrow down whether it's possible to recreate that way, or does it only happen with the KVM?
Heh, it hasn't happened once today, despite easily a hundred switches back and forth. Seems to be really temperamental - I'll update you if I figure out a way to repro it!
I haven't been able to replicate the issue when plugging/unplugging the keyboard, however it still happens a several times a day when switching back and forth with the KVM. Is there anything you'd like me to try to do to get you more information on the process state when it happens?
I think it's related to the keyboard being initialized and running when CKB gets it as a new device, though I might be wrong there. The keyboard doesn't have any time to power down, and it still retains the old profile from the old computer for about 10 seconds before CKB on the new computer takes over.
To clarify, this is ckb
that's using a lot of CPU and not ckb-daemon
?
I'm wondering if the driver/OS is seeing multiple keyboards connected. Try doing an ls /var/run | grep ckb
and see if there's more than one device there. If so, can you give me the output of cat /var/run/ckbX/features
for each of them, where X
is the device number?
Yeah, it's the ckb
process. As soon as it does it again I'll get you that info! Thanks! :+1:
Also worth mentioning, this is when it's not eating CPU. I do have another "keyboard" attached since the KVM does keyboard emulation:
eldenser:~ jriley$ ls /var/run | grep ckb
ckb0
ckb1
eldenser:~ jriley$ cat /var/run/ckb0/features
cat: /var/run/ckb0/features: No such file or directory
eldenser:~ jriley$ cat /var/run/ckb1/features
corsair k70 rgb pollrate bind notify fwversion fwupdate
Flipped back and forth until it happened on the other computer.
olothontor:~ jriley$ ls /var/run | grep ckb
ckb0
ckb1
olothontor:~ jriley$ cat /var/run/ckb0/features
cat: /var/run/ckb0/features: No such file or directory
olothontor:~ jriley$ cat /var/run/ckb1/features
corsair k70 rgb pollrate bind notify fwversion fwupdate
Still just two devices, one Corsair and one emulated keyboard.
Open files when it's misbehaving:
/Applications
/Applications/ckb.app/Contents/MacOS/ckb
/Applications/ckb.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets
/Applications/ckb.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui
/Applications/ckb.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore
/Applications/ckb.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork
/System/Library/Frameworks/AGL.framework/Versions/A/AGL
/System/Library/ColorSync/Profiles/sRGB Profile.icc
/usr/share/icu/icudt53l.dat
/Applications/ckb.app/Contents/PlugIns/platforms/libqcocoa.dylib
/Applications/ckb.app/Contents/Frameworks/QtDBus.framework/Versions/5/QtDBus
/Applications/ckb.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport
/System/Library/ColorSync/Profiles/Generic RGB Profile.icc
/System/Library/ColorSync/Profiles/Generic Gray Gamma 2.2 Profile.icc
/System/Library/ColorSync/Profiles/Generic Gray Profile.icc
/System/Library/Fonts/Helvetica.dfont
/private/var/folders/zg/ndfy6_dj78d371qzv674cb9c0000gp/0/com.apple.LaunchServices-107502.csstore
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/SystemAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/GraphiteAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityGraphiteAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/GraphiteDarkAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityDarkAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityDarkGraphiteAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/VibrantLightAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityVibrantLightAppearance.car
/System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/Resources/SArtFile.bin
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/Extras2.rsrc
/System/Library/Fonts/HelveticaNeueDeskInterface.ttc
/System/Library/Fonts/Monaco.dfont
/Applications/ckb.app/Contents/PlugIns/imageformats/libqdds.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqgif.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqicns.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqico.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqjp2.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqjpeg.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqmng.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqtga.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqtiff.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqwbmp.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqwebp.dylib
/System/Library/Fonts/LucidaGrande.ttc
/System/Library/Fonts/GeezaPro.ttc
/System/Library/Fonts/Thonburi.ttc
/Library/Fonts/Kailasa.ttf
/System/Library/Fonts/STHeiti Light.ttc
/System/Library/Fonts/STHeiti Medium.ttc
/System/Library/Keyboard Layouts/AppleKeyboardLayouts.bundle/Contents/Resources/AppleKeyboardLayouts-L.dat
/System/Library/Caches/com.apple.IntlDataCache.le.kbdx
/usr/lib/dyld
/private/var/db/dyld/dyld_shared_cache_x86_64h
/dev/null
/dev/null
/dev/null
count=2, state=0x2
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/SystemAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/GraphiteAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityGraphiteAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/GraphiteDarkAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityDarkAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityDarkGraphiteAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/VibrantLightAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityVibrantLightAppearance.car
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/Extras2.rsrc
->0x70a0221b58b78005
->0x70a0221b58b798c5
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
->0x70a0221b4bf96f25
->0x70a0221b570af94d
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
/private/var/run/ckb1/notify1
->0x70a0221b3476d8a5
->0x70a0221b461f9195
/private/var/run/ckb1/notify1
->0x70a0221b461fbd95
->0x70a0221b3476cf05
/private/var/run/ckb1/cmd
->0x70a0221b58b79605
->0x70a0221b461fb815
->0x70a0221b461f9455
->0x70a0221b461fbc35
->0x70a0221b3476eb35
->0x70a0221b461fb8c5
->0x70a0221b58b79135
->0x70a0221b461f9665
->0x70a0221b461f8a05
->0x70a0221b58b794a5
->0x70a0221b3476d325
->0x70a0221b58b78845
Open files when it's not misbehaving:
/Applications
/Applications/ckb.app/Contents/MacOS/ckb
/Applications/ckb.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets
/Applications/ckb.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui
/Applications/ckb.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore
/Applications/ckb.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork
/System/Library/ColorSync/Profiles/sRGB Profile.icc
/System/Library/Frameworks/AGL.framework/Versions/A/AGL
/System/Library/ColorSync/Profiles/Generic RGB Profile.icc
/System/Library/ColorSync/Profiles/Generic Gray Gamma 2.2 Profile.icc
/System/Library/ColorSync/Profiles/Generic Gray Profile.icc
/usr/share/icu/icudt53l.dat
/Applications/ckb.app/Contents/PlugIns/platforms/libqcocoa.dylib
/Applications/ckb.app/Contents/Frameworks/QtDBus.framework/Versions/5/QtDBus
/Applications/ckb.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport
/System/Library/Fonts/Helvetica.dfont
/private/var/folders/zg/ndfy6_dj78d371qzv674cb9c0000gp/0/com.apple.LaunchServices-107502.csstore
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/SystemAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/GraphiteAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityGraphiteAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/GraphiteDarkAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityDarkAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityDarkGraphiteAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/VibrantLightAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityVibrantLightAppearance.car
/System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/Resources/SArtFile.bin
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/Extras2.rsrc
/System/Library/Fonts/HelveticaNeueDeskInterface.ttc
/System/Library/Fonts/Monaco.dfont
/Applications/ckb.app/Contents/PlugIns/imageformats/libqdds.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqgif.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqicns.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqico.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqjp2.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqjpeg.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqmng.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqtga.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqtiff.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqwbmp.dylib
/Applications/ckb.app/Contents/PlugIns/imageformats/libqwebp.dylib
/System/Library/Fonts/LucidaGrande.ttc
/System/Library/Fonts/GeezaPro.ttc
/System/Library/Fonts/Thonburi.ttc
/Library/Fonts/Kailasa.ttf
/System/Library/Fonts/STHeiti Light.ttc
/System/Library/Fonts/STHeiti Medium.ttc
/System/Library/Keyboard Layouts/AppleKeyboardLayouts.bundle/Contents/Resources/AppleKeyboardLayouts-L.dat
/System/Library/Caches/com.apple.IntlDataCache.le.kbdx
/usr/lib/dyld
/private/var/db/dyld/dyld_shared_cache_x86_64h
/dev/null
/dev/null
/dev/null
count=2, state=0x2
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/SystemAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/GraphiteAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityGraphiteAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/GraphiteDarkAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityDarkAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityDarkGraphiteAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/VibrantLightAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/AccessibilityVibrantLightAppearance.car
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/Extras2.rsrc
->0x70a0221b461f9195
->0x70a0221b58b79765
/private/var/run/ckb1/notify1
/private/var/run/ckb1/cmd
->0x70a0221b3993d8e5
->0x70a0221b460d6115
->0x70a0221b461f8065
->0x70a0221b3476ea85
->0x70a0221b58b79b85
->0x70a0221b461f8e25
->0x70a0221b461f9df5
->0x70a0221b58b78dc5
->0x70a0221b58b794a5
->0x70a0221b461faa55
->0x70a0221b58b78635
->0x70a0221b461f9455
->0x70a0221b3476cfb5
->0x70a0221b461fb765
Looks like misbehaving it has a bunch of handles to notify1, and when it's behaving properly it doesn't. Does that help? :)
Ok, looks like the problem is that the notify-reading thread isn't being closed for some reason. I'll look into it and let you know when I find something.
Alright. If there's anything else you'd like me to do to get more info/test for you let me know - I'm pretty much on GitHub all day anyway.
Ok, my working theory is that the KVM is causing the device to disconnect and then reconnect rapidly at some point. The thread stays open because the GUI asks the daemon to re-create the notification node so quickly that it doesn't have a chance to shut down the old node first. Now, ckb actually does try to terminate the thread after closing a device, but it looks like that's not happening.
Anyway, if this is indeed the case then it should be fixed by 98366fd247bb3bb7a0a363b0e0dea688069a1680. If that doesn't do the trick then I'll look into other causes.
I'm compiling this now - I'll let you know if I see an improvement.
So far so good! I'll post another update in a few days.
Yep, that definitely fixed the issue. I'll close this out so it's out of your hair. Thanks so much!
Hiya,
On two Macs running OSX 10.10.5, I'm seeing extreme CPU usage after a day's work. I'm running a KVM that essentially unplugs the keyboard from one computer and plugs it into the other when I switch machines, so ckb is seeing the keyboard get detached and reattached quite a bit. At the end of the day after a lot of switches, the fans are noticeably loud and ckb's spinning 2-3 full CPU cores on both machines. It seems that perhaps there might be a loop somewhere that doesn't get cleaned up when the keyboard is unplugged?
I haven't been able to 100% pinpoint the scenario that causes this behavior. I've swapped back and forth and I've noticed the thread count in ckb is gradually rising as I swap. Not necessarily 1 thread per swap, but 1 thread every few swaps. In the most recent swap, the thread count incremented by one and now there's a thread eating an entire CPU core. I've attached a sample I yanked from activity monitor while this was happening - not sure if it'll be helpful or not, but can't hurt to have the info. If there's any way for me to get you better info, please let me know! :)
Thanks! -James