[BUG?] Keyboard Maestro 10 Engine Freezes Every Few Minutes for Lengthy Periods – How Do I Debug This?

Hi All and @peternlewis,

Ever since I upgraded to V10 (currently on Version 10.0.2) I see the engine freezing for 3-4 minutes every hour or so when I launch a macro (usually pallets). I have to wait 4-10 minutes before the engine becomes responsive again. How does one go and debug this?

It's making Keyboard Maestro barley usable.

thx so much

Z

Get an Activity Monitor Sample of the Keyboard Maestro Engine (or editor if it was the editor freezing) when it is frozen.

That will indicate where it is.

A possible cause would be a network reference (eg to a file or application) on a remote disk that is not mounted and that the system then decides to try to mount and fails.

1 Like

Hi @peternlewis

Thx. As requested attached are samples for both the engine and the app (which doesn't seem to freeze when the engine does).

Best

Z

Archive 2.zip (57.3 KB)

Hey Z,

Turn off all of your macro groups except 1.

See if the problem persists.

If so then turn off all the macros in that last group, and see if the problem persists.

If you can case the freezing to stop then start turning things on a few at a time. Once you've caused the problem to reoccur you can zero in on the cause.


Have you looked through your global variables to see how many and how large they are?

-Chris

The engine appears locked up asking the browser for the document URL, ie the FrontBrowserURL token (or SafariURL or ChromeURL tokens).

This is a simple AppleScript which asks the browse for the URL, and there is no reason for that ever to take any time, so it is done synchronously. But for some reason the chosen browser is not responding in a timely manner.

This could be a system interprocess communication issue (which would require restarting to resolve), or an issue related to the specific browser (especially if it is an unusual browser), or potentially could be an issue of the specific web page if there is some sort of java tie-in by the browser when returning the URL.

2 Likes

Hi and thx @peternlewis

I'm using plain Safari with latest Mac 12.1.

I tried restarting many times but that doesn't seem to help in anyway.

Any other things to try and get it debugged?

thx so much.

Z

Hey Z,

Have you looked through the Keyboard Maestro Engine log to try to find the problematic macro(s)?

-Chris

Well the code for the for the SafariURL token is simply:

tell application id "com.apple.Safari"
	if it is running then
		tell document 1
			URL
		end tell
	else
		"Not Running"
	end if
	
end tell

Run that from Script Editor and see if it works normally there.

Other than that I don’t see why it would freeze trying to get the URL.

Thx @peternlewis

So to be clear i ran that script when i got the freeze again in Keyboard Maestro (Which is getting worse and worse.. :()

This is what i get in the script editor as a result33

https://forum.keyboardmaestro.com/t/bug-keyboard-maestro-10-engine-freezes-every-few-minutes-for-lengthy-periods-how-do-i-debug-this/25650/6

Was that what i was meant to do :slight_smile:

Best

Z

Yes, that is clearly showing the problem:

image

That script should run near instantly. It is taking 2.2 seconds on your Mac.

Here is the result on my Mac:

image

0.01 seconds.

You need to find and resolve that issue with Safari / AppleScripts / That web page (if it is specific to a web page).

1 Like

Yikes...

I didn't notice the time.

@zeltak – if this is common on your system there is something very wrong with it.

Runtime on my old 2012 MacBook Air (Mojave) is about 0.01 seconds – the same as Peter shows.

And that's with only 8GBs of memory with a lot of swap at the moment.

Me'thinks you have some serious troubleshooting to do...

-Chris

gotcha

the guys..problem is i don't really know what trouble shooting i can/need to do apart from disabling Keyboard Maestro and using the computer a bit?
TBH other then the Keyboard Maestro freezes rest of the MBP has been running pretty smooth
will dig into this

thx and happy new year!

Z

Things to try:

  • A different user account
  • Safe booting
  • Removing any osax
  • Considering any other extensions you might have installed
  • Consider/disable any Safari extensions you have installed

This is very basic AppleScript and there is no excuse for it taking more than a tiny fraction of a second, and while you may not be seeing any other consequences, it'll be surprising if there isn't anything else going on.

1 Like

Hi @ccstone and all again,

So I'm really having a tough time debugging this

It seems like this slow down also affects Safari (doesn't load web pages) and perhaps other apps

Yet I cant understand what's causing this. I removed all Safari extensions but that doesn't help.

It seems like with a blank (other user) this isn't happening (or at least it seems this way).

How does one then identify the culprit?

Any suggestions would be super helpful!.

thx all

Z

Hey Z,

I'd be researching things like β€œsafari slow down” on Google.

You might also have a look here:

Macintosh Routine Maintenance

-Chris

Try a Safe Boot. Safe Boots clear out all the caches.

Check any Launch Agents or Launch Daemons you have installed in:

  • /Library/LaunchAgents/
  • /Library/LaunchDaemons/
  • ~/Library/LaunchAgents/
1 Like