KM hangs when any macro is triggered in Excel

Any time I fire any macro while Excel (2011) is at the front, KM hangs for 10–15 seconds. This is true even if the macro is not for Excel (eg a macro to activate a different application).

Hey Jack,

That’s odd. It doesn’t happen to me with Excel 14.5.7 on OSX 10.11.

-Chris

Odd indeed!

Anyone have any troubleshooting recommendations?

Hey Jack,

Install a fresh copy of the Keyboard Maestro app.

Install a fresh copy of Excel.

Clear the Excel app from the macro group by setting it to a different app – then set it back.

Quit and restart both the KM Engine & Editor.

Open the Console app and hit K to Clear Display.

Open up the Keyboard Maestro Engine Log in the Console, and Clear Display.

Run some macros.

If Excel still hangs then quit every user-process you can and try again.

If it still hangs then something really strange is going on.

You might also use the Disk Utility to Verify/Repair your disk just for giggles.

-Chris

Thanks, Chris.

I’m using El Cap which no longer requires permissions repair.

What do you mean “install a fresh copy”? Won’t that just overwrite the app file itself, which doesn’t contain any of the problematic (corruptable) plist information?

Hey Jack,

Disk repair and permissions repair are not one in the same.

Sometimes the app files themselves can become damaged.

When I have weird problems with a particular app I'll often start by replacing the app itself before moving on to all of its support files. Usually that just takes a couple of minutes.

A number of times over the years I've spent hours troubleshooting and then found that replacing the app fixed the problem – so these days I put replacing the app early in the process.

It depends of course. Sometimes removing prefs and/or ~/Library/Application Support/ items does the trick.

Then again OSX doesn't require near as much TLC as Systems 6, 7, 8, 8.5+, 9, 9.5+ – so I don't spend all that much time troubleshooting anymore.

I've been doing all this since 1984, so I have just a little bit of experience.

-Chris

Thanks, Chris! I appreciate the guidance. I am using Excel 2016 for now but will let you know if I try these.

Hi there,

I left this alone for a while and have recently run into another problem that seems related.

Any time I copy anything from Excel 2016, Excel and the KM Engine hang. If I have just copied a few cells, the hang is momentary (2–3 seconds). If I copy a huge amount of data, they both hang for 1–2 minutes.

@ccstone, I went ahead and went through your steps above

Install a fresh copy of the Keyboard Maestro app.

Done

Install a fresh copy of Excel.

Done; I reinstalled Excel 2016 not 2011 since that is the problem app now.

Clear the Excel app from the macro group by setting it to a different app – then set it back.

I just turned off the macro groups I had assigned to Excel. I ensured that no macros were firing when I reproduced this behavior.

Quit and restart both the KM Engine & Editor.

Done

Open the Console app and hit ⌘K to Clear Display. Open up the Keyboard Maestro Engine Log in the Console, and Clear Display. Run some macros.

Done, the Console doesn’t output anything because the KME is hanging when this happens.

If Excel still hangs then quit every user-process you can and try again.

Done

If it still hangs then something really strange is going on.

Yep :frowning:

You might also use the Disk Utility to Verify/Repair your disk just for giggles.

Done recently

Hey Jack,

Excel has its own proprietary stuff in the clipboard, so when you move to another application (not just Keyboard Maestro) the clipboard has to be exported.

This can cause significant delays when copying large amounts of data.

So, that part doesn't shock me (too much).

However, 2-3 seconds for just a few cells is unreasonable.

I have a test macro for Excel 2011 that simply copies to a named clipboard and then displays it in a window. It takes 1.1 seconds to run with a selection of over 200 cells on my system.

-Chris

Okay. So something is definitely wrong with Excel or KM or both.

More likely, something is wrong on your Mac. I presume you’ve tried restarting? It may also be that there is something else messing around with the clipboard. It’s also possible there is some weird preference in Excel that you’ve inadvertently enabled.

Hi @peternlewis, thanks.

I presume you've tried restarting?

Yessir.

It may also be that there is something else messing around with the clipboard.

Per @ccstone I reproduced the issue with as few other user processes running as possible. So I can’t rule it out, I guess, but it’s not TextExpander or some menubar app or something like that, as far as I can tell.

It's also possible there is some weird preference in Excel that you've inadvertently enabled.

I just wiped all Excel prefs and logs and stuff and reproduced the issue, so I’m inclined to think that’s not it?

My Console did spit this out:

2/3/16 11:17:23.670 AM Keyboard Maestro Engine[481]: Assertion Failed: [i_runningApplications[0] isEqual:i_frontmost], file: /Users/peter/Keyboard Maestro/Project/Source/XCAF/XRunningApplicationsList.mm:201, value: 0

Just reproduced the problem and Console also gave me a zillion of these:

2/3/16 11:25:12.624 AM Keyboard Maestro Engine[481]: assertion failed: 15C50: libxpc.dylib + 35399 [61AB4610-9304-354C-9E9B-D57198AE9866]: 0x13

libxpc sounds like the system interprocess communication system.

And its a libxpc assertion, not a Keyboard Maestro assertion, so I don’t know from that what Keyboard Maestro is even trying to do at the time.

Looking around the net there is a whole bunch of those with no clear common denominator. It looks like 15C50 is the OS version.

I don’t really have any idea how to narrow down what the issue is. You could try creating another account, or safe booting, but I’m not sure how much they will tell you.

@peternlewis Thanks so much for looking in to this and giving your advice. No dice, but I can survive. :smile:

Just thought I’d add that I am getting similar messages routinely showing up in my Engine.log from KM 8.2:

2018-04-11 16:57:34 Assertion Failed: good,  file: /Users/peter/Keyboard Maestro/Project/Source/XCAF/XRunningApplicationsList.mm:49, value: 0
2018-04-11 16:57:34 Assertion Failed: r,  file: /Users/peter/Keyboard Maestro/Project/Source/XCAF/XRunningApplicationsList.mm:148, value: 0
2018-04-11 16:57:34 Assertion Failed: i_runningApplications.count > 0 and [i_runningApplications[0] isEqual:i_frontmost],  file: /Users/peter/Keyboard Maestro/Project/Source/XCAF/XRunningApplicationsList.mm:209, value: 0

I can’t really trace it to any single cause. But I will say that for quite some time I’ve noticed when applications that KM is watching (via Application triggers, window triggers, or other such macro triggers) are busy and non-responsive, KM also becomes non-responsive - I get the mouse pinwheel over the KM system menu extra, and clicking does not open the popup menu until the application in question has resumed execution. My gut tells me that these events are loosely related but I don’t know.

My assumption is that the system hooks are in a thread lock or wait state and everything tied into them suspends while it’s waiting.

Unfortunately, they are simply caused by Apple's running applications API being completely rubbish. That first assertion is basically Keyboard Maestro asking the system this sequence:

KM: What is the front application?
System: X
KM: OK, give me the list of running applications?
System: A,B,C
KM: Uhh, you might notice, X is not in that list (assertion number 1)

The other two are just follow-ons from this failure.

Keyboard Maestro does it's best to work around the system failing, but it's pretty difficult when the system is telling you that the front application is not a running application.

You'll also see a lot of complaints from Keyboard Maestro about the time that the running applications APIs take to respond to trivial queries, often up to a sizeable fraction of a second.

1 Like