KM Engine Log Entry About Application Query Corresponds to 30 Second Freeze in KM

KBM is repeatedly freezing with a spinning beach ball. After some 15 to 30 seconds it works.

It corresponds to this entry in the engine.log

2020-08-13 10:10:35 Running application query took a while (3695 us)

thanks in advance for your time and help

I hope you don't mind that I have revised your topic title to better reflect the question you have asked.

FROM:
Interpretation engine.log 2020-08-13 10:10:35 Running application query took a while (3695 us)

TO:
KM Engine Log Entry About Application Query Corresponds to 30 Second Freeze in KM

This will greatly help you attract more experienced users to help solve your problem, and will help future readers find your question, and the solution.

1 Like

Since 3695 us is only 0.004s, it is unlikely this has anything to do with your issue.

At a guess, I would say you issue is related to:

  • Clipboards
  • Applications
  • AppleScript

But to find out, you need to get an Activity Monitor Sample of the Keyboard Maestro Engine process while it is frozen. That will indicate exactly where in Keyboard Maestro it is frozen, which would lead to the resolution.

1 Like

thank you Peter. I will have a look

Thank you J. Very good idea !

First and foremost, I hope that your whole family is well. If you have children of school age, I imagine that it must be very stressful to send them back to school.

As I mentioned, KBM is frequently freezing with Spinning Beach Ball, sometimes to such an extent that I have to quit KBM to be able to work. The freezing happens when I am in KBM and is a huge pain.

I would like to seize this opportunity to establish some kind of procedure which would be useful for other users as well as for you, so users present you with well documented problems.

If I understand correctly, at the exact time I see the Spinning Beach Ball, I do the following:
Activate the activity monitor → follow steps below → upload the saved sample text to the forum for troubleshooting.

  • Did I understand correctly ?
  • obviously the whole procedure has to be done fast and KBM is frozen, so I can't use a macro to do so. Would you or @JMichaelTX know if the exists an AppleScript I could trigger at the instant the problem arises which would carry out the procedure below and save sample text to file, or at least display it.

thank you Peter

All well here. Currently there is no stress because Western Australia is Covid-free, but I do feel for pretty much all the rest of the world - and I don't know how much longer we'll be able to maintain out status.

Correct.

Basically, just leave Activity Monitor running with Keyboard Maestro Engine selected.

The Call graph (which is just below the image you show) is what is required - specifically the part where the numbers stop all being more or less the same large number, and/or stop being in Keyboard Maestro code.

2 Likes

great. thank you Peter

Peter, may I suggest that it is MUCH easier for the user to just click on the "Save" button on the "Sample Process" window, and zip and send that file to you.

The "Call graph" lines in the report don't even show at first, and I was confused what you were talking about. I looked for a button or link named "Call graph".

Also, may I suggest that you put this entire process, with good example images, in the KM Wiki.

Thakns.

Hey @ronald,

This is precisely why I recommend to everyone who uses Keyboard Maestro that they also install FastScripts.

The free version gives you 10 keyboard-shortcut-driven AppleScripts and unlimited menu-driven AppleScripts. The $10.00 paid version allows unlimited keyboard shortcuts.

When Keyboard Maestro jams (as it does occasionally) you still have options for automation.

The following AppleScript will:

  • Open the Activity Monitor.
  • Find the 'Keyboard Maestro Engine' process.
  • Select it.
  • Create a Sample.

I leave it up to the user to save the Sample.

I only guarantee the script to run on macOS 10.12.6.

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2020/08/14 18:18
# dMod: 2020/08/14 18:18 
# Appl: Activity Monitor, System Events
# Task: Sample Process 'Keyboard Maestro Engine'
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @ASObjC, @Activity_Monitor, @System_Events, @Keyboard_Maestro_Engine
# Test: Only on macOS 10.12.6
-------------------------------------------------------------------------------------------

tell application "Activity Monitor" to activate

tell application "System Events"
   set frontAppName to name of process 1 whose frontmost is true
   repeat while frontAppName is not "Activity Monitor"
      delay 2
   end repeat
end tell

tell application "System Events"
   tell application process "Activity Monitor"
      
      tell menu bar 1
         tell menu bar item "View"
            tell menu 1
               tell menu item "My Processes"
                  perform action "AXPress"
               end tell
               tell menu item "Filter Processes"
                  perform action "AXPress"
               end tell
            end tell
         end tell
      end tell
      
      tell window "Activity Monitor (My Processes)"
         tell toolbar 1
            tell group 3
               tell text field 1
                  set its value to "Keyboard Maestro Engine"
                  perform action "AXConfirm"
               end tell
            end tell
         end tell
      end tell
      
      keystroke tab
      key code 125
      
      delay 0.5
      
      tell menu bar 1
         tell menu bar item "View"
            tell menu 1
               tell menu item "Sample Process"
                  perform action "AXPress"
               end tell
            end tell
         end tell
      end tell
      
   end tell
end tell

-------------------------------------------------------------------------------------------

-Chris

2 Likes

Thanks Chris. This is really helpful. :+1:

I did have to make a minor adjustment to run on my 2019 iMac, running Keyboard Maestro 9.0.6 on macOS 10.14.6 (Mojave):

image

@ronald et al: Adjust the amount of delay as needed for your Mac.

Even though AM was running, somehow it was not fully ready for the rest of your script.

FastScripts is great and I have owned it for years.

For those of you who own LaunchBar, and don't want to dedicate a hot key to a script that hopefully you will seldom need, you can use LB to trigger the script, and assign an intuitive (to you) LB abbreviation. I used "KMSP" for Keyboard Maestro Sample Process.