Jump to content

Recommended Posts

Posted

I wrote a script based on a loop. I want my script to check at the start of every cycle if one or more processes are still running and responding, then react if they are no more. I can do the former using ProcessExist, but how about the latter?

Does exist a function that verifies if a process is still responding?

Thanks in advance

  • Moderators
Posted (edited)

Process "responding" is going to be different depending on the process. What is the process, and what defines that it is still working (writing to a db, output to a file, etc. etc.)?

You can always use ProcessGetStats, to return an array of the operations performed, and compare from loop to loop (e.g. if number of read operations between loop 1 and 2 has increased by at least x%)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted (edited)

Per this post, you are trying to monitor Firefox and the Flash plugin. Can you provide a link to the site you are trying to interact with?

Thank you for yor help.

Here some examples

http://www.twitch.tv/

http://vimeo.com

and more streaming sites using flash plugin.

Here is the background, a description of the script I am coding:

A script to open Firefox and go to a random URL. The url changes randomly every X minutes between 12.00 Pm and 4.00 Pm through a loop.

I want to make my script to be as indipendent as possible. To do so I need it to check if:

- Firefox is still working and responding (working on my on my own)

- Adobe Flash plugin is still working

- Plugin-container is still working

- ?Others sensible processes able to compromise the script?

Also, I am not sure what is better, to perform the check at the beginning of the loop or to perform it regularly, i.e every 5 minutes.

 

EDIT: NOPE: I am working on streaming sites only, no bots involved :)

Edited by skyhigh
Posted (edited)

maybe https://www.autoitscript.com/forum/topic/116592-checking-if-process-is-suspendedhangednot-responding/
https://www.autoitscript.com/forum/topic/111679-how-to-know-if-a-process-is-not-responding/

I read in stackoverflow:

There is no general solution to this problem.

It is impossible to tell if a particular process is hanging or not, because the term "hanging" is entirely dependent upon the context of the process that is executing.

The hanging process will always do what it was coded to do. The developer may have coded it badly, but Windows can't make assumptions about what is right/wrong.

Possible ideas to try might be:

  1. The Process.Responding call will indicate whether or not a process that is executing a windows message loop is responding.

  2. One possible solution for the more general case might be to poll the memory usage for the process at intervals and if it doesn't change after enough time, assume that it is hung. You could do this with Process.WorkingSet64. However, I expect that this would cause a number of false positives - stable processes that are not processing anything might appear to be hanging. It would also cause false negatives where a hanging process that had a memory leak would appear to be doing something useful, when in fact it was stuck in a loop.

  3. If the process writes to the StandardError/StandardOutput streams (as many console applications do), then you could try listening for such output: Process.BeginOutputReadLine and Process.BeginErrorReadLine. If there is no such output within a given period, you might deduce that it has hung.

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

  • 1 month later...
Posted (edited)

Well, I am still alive and so is my script.
After the information you gave me I have performed some searches through the net. I have found a software that could be useful to me: Kiwi Application Monitor. It has a free and a paid version. The paid version is the most interesting one because it allows you to set advanced rules for specific processes. The rules are not different from scripts created through a GUI:

u2bCBZj.jpg

As you can see from the screenshot Kiwi has even a way to know if a process is responsive or not, which seems exactly what I am looking for. Unfortunately Kiwi has not a trial version, so I can't try its full power.
If I buy it my problem will change: I'll need to manage the interaction between my autoit script and Kiwi . I am thinking about it, but it does not look to be a simple task. While I would solve the main problem (what to if FF stop responding or crashes) I have not figured out yet how to tell autoit that a third part software is closing or rebooting FF. I don't think a specific process would appear in these cases.

What do you think about it?

 

 

Edited by skyhigh
Posted

Do you think it's spam? I can understand your reasons but you are totally wrong. To be clear, I have just asked to a mod if I ought to edit the name of the software from the post and from the screenshot. If he will tell me to do it, I will execute immediately.

But I will not give up the core of my question.

I began to work on this script months ago. I wrote it one piece at time, some parts of it thanks to the people of this forum. I do not have much time to dedicate to it but I really want to complete my script.

The last answer from @argumentum clearly says that there is no a definitive and easy way for autoit to do what I need. Paying some dollars could save me from spending a lot of time of study and trial-and-error scripting. In this case I'll be glad to pay!

But if you do know better than him please, go on and tell me, explain to me: because I would be even gladder if I spare some bucks.

 

 

 

Posted (edited)

There have been many suggestions here in this thread, you've come back after a while posting a third party app, but you have not tried any of the suggestions or at least not posted what you tried, and that's what makes me think it's just an ad.

But I'm just a person on the internet who answered your question, you can safely ignore me.

And that screenshot does not mention a process at all, just app, it's most likely using some or all of the approaches mentioned here.

EDIT: And here's another thought, when a process stops working, windows generally notifies you off it "Blah has stopped working, close, debug, send error report" etc...

EDIT2:

Can you clarify what "non responsive" means from a system point of view? What exactly is Kiwi looking for with this condition?

It's like pinging a server: Kiwi sends a command to an application GUI to which she responds. If the application does not respond, it either froze or is under heavy processing. So if you include the "above 90% processor load" rule, you can rule the last occasion out.

http://www.kiwimonitor.com/forum/viewtopic.php?f=4&t=95

In other words "_WinAPI_IsHungAppWindow"

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

The last answer from @argumentum clearly says that there is no a definitive and easy way for autoit to do what I need.

lol, nope, I said what's written. And looking at the website, the app. they show, can be perfectly written in AutoIt.
As far as "an easy way", well, the code has to be written. It certainly is time consuming.
The money the ask is not much, go for it. But I feel, it will not satisfy your wanting.

Anywayz, just wanted to clarify and give my 2 cents.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...