macOS 10.13.4 Freezing with BetterTouchTool Usage

Thinking about this... one of the major differences here is, that an app change does modify the menu bar content, a window change within the same app does not.

Also opening spotlight search per ⌘+Space does not modify the menu bar.

Not sure how my observation with the search box in activity monitor fits into that theory - that does not change the menu bar content.

If in fact it is related to changes of menu bar content, then the likeliest conflicting app seems to be Bartender. https://www.macbartender.com/

Oh, interesting. Until now it seemed that use of USB input devices was a common factor.

EDIT: actually, I'd think that even in a laptop the interal keyboard and touchpad are still attached to the USB bus? So it could still be related to input devices I guess. Although as I and others have reported, it's not only an input freeze - screen refreshes often stop for me as well.

Now you mention it, I have a similar finding: I don't use Spotlight because I use Alfred 3. But like you found, opening Alfred search (which I also do with ⌘-Space) does not trigger a freeze.

As per my edit in my previous post, I can confirm the AM search bar also causes a freeze for me.

Yeah good point - menu bar switch does seem a common factor in all occasions except the AM search bar. Probably that AM search bar means the menu bar isn't a factor, but it's worth testing.

I have just had my latest occurrence, 3 days, 16 hours and 20 minutes after I rebooted to install an OS update (to 10.13.6 B5). As per my edit to my previous post, this happened when I opened Alfred 3's preferences window. Nothing to do with Path Finder this time, so those previous occurrences were likely a coincidence.

I have now closed Bartender, then restarted BTT to clear the issue. So if Bartender is a factor, I will know in.. 3 to 5 days :slight_smile:

Interesting how many of us seem to have fairly predictable intervals, but they're all different. Yours are ~24 hours. Mine were originally around 96 hours, then I had a 120 hours followed by 88 hours.

I don't use Bartender on either Mac, and the problem occurs. The Retina Macbook 2017 with latest HS has no peripherals, and only Microsoft/Adobe/Apple stable software installed. And BTT. That should rule out a conflict with exotic apps or peripherals.

There's more to this. It's a past experience: I hadn't yet associated the problem with BTT. Because the computer was extremely slow to use, I did not try quitting BTT or do much troubleshooting at the time of the observation. I just used a keyboard shortcut to reboot the Mac. So, I haven't tried that method yet. It may work! I will try it if the problem happens again. Today I found this thread, applied the terminal spell, and started using BTT again after a 2 day break.

The log message can be seen with Console.app. Filter for "kernel" in the all-inclusive log after the problem happens. After that, with every stutter, you should see a matching "kernel stalling" message whenever the stutter begins. For me the freeze repeats, when I try to interact with the computer with a mouse/trackpad, and an accompanying Console message appears at the same time. They're gone after reboot.

CPU spikes may not be the cause, it's just correlation. The computer could idle on for 24 hours without a hiccup, but after I started working, within a few hours there was a freeze or two, every workday. That's been the case for the past few weeks. Time will tell if the terminal defaults command helps. If I get more freezes, I'll capture the debug log.

Perfectly on time my system was freezing at 5:20pm CET - while I was on video conference per Zoom.us.

Again, only power is connected. No external USB devices and no BT devices connected.

I'm also seeing the "stalling for detach from IOHIDSystem" on every freeze and CPU usage spike of +20%. Usually my system is not using more than 15% to 20% even when Zoom is running.

I killed all of the applications listed in my previous post per activity monitor and nothing had an effect on the freeze. Only killing BTT solves it.

We can also rule out the change of menu bar content. While some interactions with icons in the menu bar cause no freeze, others do. For instance, I'm using Fluid.app to show an JIRA overlay on the desktop and this does not change the menu bar content - but freezes the system.

I'm leaving BTT turned off now. As said, let me know if I can help debug this any further. Also, since this happens for me very reliably around the same time of the day, I can offer you to do a live screen sharing session via Zoom so you can search logs in console yourself etc while it's happening.

Cheers,
Daniel

Interesting. There must be some correlation there, something in a video conference call that triggers it, or increases the likelihood of triggering it. Perhaps related to use of the webcam and/or microphone? An extra device in use? (I assume an internal webcam is on the USB bus, though the microphone probably isn't.)

I've not yet had another occurrence - I'm not due another one for at least 24 hours, on my usual schedule. When I do I'll check the Kernel stalling message. Presumably I'll see it as well.

Regarding those CPU spikes - that may well be tailspind and/or spindump, rather than the freeze directly causing a spike of its own. I noticed that the first time it happened - I had Activity Monitor's CPU chart open and every time a freeze occurred, I briefly saw tailspind or spindump hit the top of the CPU %. Whatever app I was switching to or from would be noticed by the OS as freezing, so it profiles them with tailspin/spindump and that generates a CPU hit.

I'm sure @Andreas_Hegenberg is debugging this and will find something soon. Luckily for me it's only every 3-4 days so I don't have to give up using BTT, I'll just deal with restarting it periodically. I have so many gestures configured I'd be lost without it!

FWIW, I run Zoom a lot, and most of my BTT hangs are when Zoom isn't running.

Just happened, much sooner than expected. 2 days 14 hours from the previous occasion. This time it was when I clicked away from Microsoft Remote Desktop onto a different tab in Firefox - so both switching to Firefox and changing the visible tab.

I can confirm that I too have the "stalling for detach from IOHIDSystem" messages in Console.

This time seemed a bit more severe, in that the freezes also caused the audio to stop in a playing video, and seemed to last a bit longer than the ~15 seconds I measured previously.

Luckily BTT can be configured with a shortcut to restart itself. I've made that to be control-command-option-backspace. I just hit that when the freeze happens. Not an optimal situation, but it's an easy to use workaround to continue using BTT.

I got another freeze yesterday, even after the terminal spell had been applied for days. Forgot to catch the logs though, sorry.

thanks for the logs everybody, I'm now pretty sure about the change in 10.13.4 that's causing this and will release an update soon.

I'm currently on our honeymoon, mostly without internet, so it will probably not be available until end of next week unfortunately.

2 Likes

Thanks Andreas! But please - don't you dare to work in your honeymoon! All best wishes to you and your wife and have an awesome time! :slight_smile:

DO NOT WORK ON YOUR HONEYMOON! No bug fix is worth that. :slight_smile:

Congratulations, Andreas! Hope you've had/are having a great honeymoon.

I've just emailed a new set of logs in case they're still of any help.

That's great, I hope you've found it. I did think I should mention that for me the issue didn't occur until a long time after I first started using 10.13.4 - in fact by the time I got my first freezes, late June, I was on the last beta of 10.13.5 (basically same code as 10.13.5 final, I think.) I didn't have any freezes while using 10.13.4, or its betas.

But maybe something also changed in BTT, or the issue got a lot more likely with further changes in 10.13.5 or 10.13.6. Anyway, fingers crossed the update does fix it.

A data point for when you are home: I have experienced this issue twice, but only since I upgraded to MacOS 10.13.6 from 10.11.6 four days ago.

I use BTT 2.530 (before and after upgrading from El Capitan). iTerm2, Firefox, and Discord are by far the applications I most interact with. No USB devices (other than the internal keyboard/touchpad).

Like others, the freezes occur when switching applications, and exiting or restarting BTT fixes the issue. BTT Remote is also affected.

I cannot verify what others have reported regarding the freezes not occurring when switching between windows of the same application, the issue not affecting menubar utilities, or the Activity Monitor searchbox, but will try the next time it happens.

Hello everyone,

I'm also experiencing this issue. What I can report is that it happened right after the installation of the last update (10.13.6). I associated the lag on multiple applications to the update itself. However, after a while, I realised that if I closed BetterTouchTool the issue is gone. If I open it, the issue starts again. I believe the bug reports and logs from the other guys will help you with the correction. However, if needed, I can perform any test needed to help you debug the issue. However I do believe that the most relevant information I can give you is that it really started with the 10.13.6 update. Notice right after the update reboot.

Switching off BetterTouchTool is a pain but it also helps me remember how much I like BetterTouchTool =) Thanks!

What version were you running before updating to 10.13.6?

I've also been getting this freeze for almost a year now! First I thought it was my MacBook Pro, that it / or the video card in it might be dying. Then, I thought it was High Sierra being buggy. I contacted Apple and have searched around the internet high and low, and found nothing, until I came across this thread here after searching on "stalling for iohidsystem". Thank God I found it.

The freezing was driving me absolutely crazy, and has frankly been getting worse, and I didn't think it could be my beloved BetterTouchTool. Until I saw this thread.

I would try to check the Mac's Console app when the freeze occurred (I would leave it open all day just to catch it), and found errors similar like these:

fault	16:49:33.902047 -0700	kernel	virtual IOReturn IOAccelEventMachine2::waitForStamp(int32_t, stamp_t, stamp_t *): initial wait for 1 second expired. Continue wait for 4 seconds. stamp 502913 (gpu_stamp=502912)
fault	16:49:37.902351 -0700	kernel	virtual IOReturn IOAccelEventMachine2::waitForStamp(int32_t, stamp_t, stamp_t *): timeout waiting for IntelAccelerator stamp 502913 (gpu_stamp=502912)
fault	16:49:37.902365 -0700	kernel	void IOAccelEventMachine2::handleFinishChannelRestart(IOReturn, int32_t, uint32_t) - Setting restart type to 4
fault	16:49:37.902370 -0700	kernel	void IOAccelEventMachine2::handleFinishChannelRestart(IOReturn, int32_t, uint32_t): GPURestartDequeued stampIdx=4 type=4 fromWhere=1 waitingOnIdx=4 default	16:49:37.902373 -0700	kernel	[IGPU] display event timeout on index = 4
fault	16:49:37.902426 -0700	kernel	void IOAccelEventMachine2::restart_channel(): GPURestartSkipped stampIdx=4 type=4
fault	16:49:37.902429 -0700	kernel	void IOAccelEventMachine2::restart_channel(): no channel associated with stamp_idx 4 (type 4)

I used my Mac for a few days without BTT running, and I got zero freezes, when I would otherwise get 3-10 per day, some so severe and frequent I could barely move my cursor and had to reboot.

Btw, there are lots of threads on Apple's support communities about this freezing, so you might want to post these solutions there to let people know what is going on and that it isn't their Mac or High Sierra (like me, before I found this thread). I counted about 8,000+ people reporting this issue (who used the "I also have this problem" button) across about 6-8 threads on the Apple support forum.

Anyway, I do love BTT and your hard work on it, so thank you. It has become an essential app for me on my Mac! I look forward to a fix soon, which I have no doubt you will be able to provide, and congratulations to you and your wife on getting married! All the best, and thank you again!

(btw I'm on v4.427 (787) of BTT and v10.13.6 of Mac OS / High Sierra)

Hello, I have had the same issues (once or twice per day the freezes) on macOS.

As a quick workaround I created a script to restart BetterTouchTool preventively every 30min. Since then (> 1week) no issues at all.

Here's how to do it.

Create an Apple Skript (mine is called BetterTouchTool_Restart.scpt):

tell application "System Events"
	set ProcessList to name of every process
	if "BetterTouchTool" is in ProcessList then
		set ThePID to unix id of process "BetterTouchTool"
		do shell script "kill -KILL " & ThePID
	end if
end tell

Now export this script as a program (from Script Editor), mine is called BetterTouchTool_Restart.app

In order to run this program every hour create a plist file (mine is named com.example.BetterTouchTool_Restart.plist) with content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.example.BetterTouchTool_Restart</string>
    <key>Program</key>
    <string>**PATH-TO-YOUR-PROGRAM**/BetterTouchTool_Restart.app/Contents/MacOS/applet</string>
    <key>StartInterval</key>
    <integer>1800</integer>
</dict>
</plist>

... At last: copy this plist file to the folder: ~/Library/LaunchAgents (~ is your user folder)

You might need to logout and login again (not sure) and that's it. This will kill BetterTouchTool but the Helper will Restart BetterTouchTool automatically again. Hope this helps to some of you.

I was using 10.13.5.

yeah, best time ever, enjoy YOUR HONEYMOON. :slight_smile: