Script Debugger unable to enumerate process properties for itself?

So I was (slowly) stepping through code that retrieves several properties of the frontmost process. But when Script Debugger tries to enumerate all of the properties for itself, it runs into an issue at some point (starting with the “entire contents” property?) , including System Events going on to rack up gigabytes of RAM.

My best guess as to why this might be happening would be due to some sort of infinite loop with Script Debugger retrieving a list of all of its UI elements, updating its UI, which then results in another addition to the UI elements that then have to be newly retrieved, and so on? In any case, I’m not sure whether this is happening “by design” or not, and whether System Events, Script Debugger or neither are to blame?


tell application "System Events"
    get (the first process whose frontmost is true)
    result's name
end tell

Movie that demonstrates what I’m seeing:

1 Like

This is not a Script Debugger bug. Script Debugger’s explorer is sending get AppleEvent commands to System Events to read each of the properties of this particular process instance. In the case of the entire contents property, System Events is taking a long time to respond and ultimately the event times out (error -1712 = errAETimeout).

But is not over. While Script Debugger gives up following the timeout, System Events is still hung producing the result of the get entire contents of process 'x' event. Therefore, all subsequent AppleEvents sent to it, including result's name, are blocked until System Event finally finishes producing a result for the entire contents property.

If you switch Script Debugger’s result viewer from Best to Source, you can avoid this problem (i.e. not have the explorer introspect System Events’ process instance).

ok, I’ll make sure to do that. Thank you very much for looking into it! What seems weird to me is that with Script Debugger freshly launched and a single document window open, the following will finish in 1-2 seconds when executed from OS X’s Script Editor exactly once:

tell application "System Events" to tell process "Script Debugger" to get entire contents

Subsequent executions, unless the Script Debugger application is relaunched in between, fail to finish and rack up gigabytes of memory, the same behavior I’ve described seeing when running the script from Script Debugger itself .

I’m perfectly content to accept that this is on System Events though. Thanks again! :slight_smile: