Excessive script time relaunch

Tom Yarmas tom at yarmas.com
Mon Apr 20 09:04:39 EDT 2020


Interesting. Not sure how I missed this email in Feb. I will set this up and monitor.

The only things I have ever had as run away processes that cause my XTension system to be a problem have been Weatherman and Video Pitcher. The former more than the latter, but both way too frequently.

-tom


> On Feb 25, 2020, at 10:06 AM, James Sentman <james at sentman.com> wrote:
> 
> 
> Good morning Ard,
> 
> Is this a problem with some process on the mini using up 100% of the CPU either XTension or other? I have had similar issues in the past and have done things to regularly monitor for a high CPU usage situation.
> 
> In XTension if you create a pseudo unit named “_idle” just underscore (no space) idle it will get filled in with the idle percent on the machine every 5 seconds. You may want to then disable that unit in XTdb so that it doesn’t write a potentially HUGE amount of data to your database that is not important ;) You can use the future value in the On script to check for a 0% or very low percent idle and then do something about it.
> 
> if you don’t know what the offending process is you can discover it at this point by doing something like this in the _idle units ON or OFF script. You might have to do it in both places as it might actually run the off script if the value gets down to 0! So experiment with that I don’t recall if I had to do that or not.
> 
> You can get the current usage of all the apps on the machine by doing a shell script like:
> 
> ps aux
> 
> so if you want to record that in a script in XTension you can do something like:
> 
> do async shell script “echo ‘- - - - - - - -‘ >> ~/Documents/psout.txt ; date >> ~/Documents/psout.txt ; ps aux >> ~/Documents/psout.txt”
> 
> that will append the separator line and then the date/time and finally the data into that output file otherwise you’ll not know when the data was or where one ends and the next begins ;) 
> 
> You can then open that later and figure out what process is spun up and hanging up everything else. If it turns out to be XTension then we can further debug that, but most likely it’s something system wise. I’ve had problems in the past with powerd and something called “distnotd” and wrote some scripts to monitor them and kill them (the system will restart them) if they got out of control.
> 
> Of course you don’t want to do that every 5 seconds when the value is below some point, so you’d want to check the current value against the future value and only run the script if it was sliding below the value for the first time. So say you want to take a sample whenever the CPU usage drops above 90% you could do something like:
> 
> if value of (thisUnit) is greater than 9% and (future value) is less than 10% then
>   — do the above script
> end if
> 
> that way it won’t fill the file with thousands of samples every 5 seconds while it’s in that state, but just the one when it first happens which should be enough to see.
> 
> If it’s a system file then it’s probably not actually necessary to restart, just kill the offending process. If it comes to that let us know and we can send more scripts to do that. You’ll probably have to sudo them which is possible with that command as long as you don’t mind embedding your password into the script. If you really do need to reboot then you can also use the shell script reboot command. That also requires to be run with sudo so the same thing applies as before. What that does not do is a clean shutdown telling all the apps to save their data and such like the shutdown command from the Apple menu does. It just kills everything. So before issuing that you’ll want to have XTension save it’s database and quit any other apps that may have unsaved data and then probably issue a file system sync and then do the sudo reboot. I can help with the specifics if it comes to that ;)
> 
> First let us know what you discover with grabbing the PS data when it happens.
> 
> Of course, as I think about that it’s not fully necessary to grab the data automatically, you could always just go look at the Activity monitor when it happens, but this will get it right away at the first occurrence and not wait for you to discover that something is up.
> 
> 
> 
>> On Feb 24, 2020, at 1:53 PM, ard jonker <ard.jonker at xs4all.nl <mailto:ard.jonker at xs4all.nl>> wrote:
>> 
>> Is there a way to catch the routine that causes an 'Excessive script time' message in the log and then reboot the machine, or at least, restart XTension from its own macro/software/command?
>> 
>> It is not that there is an error in a script, it is just that the mini's fan is hissing at me and (all) scripts take "forever". The dock then tells me the application is not responding and suggests a force quit. That is not really the only option, but the other one is just a lot of patience. Occasionally (twice a month or so) this happens to me and it is quite difficult to get out of that loop if you are not near the machine to push the on/off button. Especially in the morning, in a bedroom that stays dark |-(
> 
> Thanks,
>  James
> 
> 
> James Sentman                       http://www.PlanetaryGear.org <http://www.planetarygear.org/>		http://MacHomeAutomation.com <http://machomeautomation.com/>
> 
> 
> 
> 
> _______________________________________________
> XTensionList mailing list
> XTensionList at machomeautomation.com
> http://mail.machomeautomation.com/mailman/listinfo/xtensionlist

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.machomeautomation.com/pipermail/xtensionlist/attachments/20200420/29375009/attachment.html>


More information about the XTensionList mailing list