Sign in to follow this  
Followers 0
JonnyThunder

Catching hangs / detecting dead processes

6 posts in this topic

Hello again,

Right. I've written a rather complicated script which scans all the PCs listed in our Active Directory and scans them for various things. The problems begin, when using WMI connections. If a machine has issues with WMI - often the script will just hang. Now, out of 5000+ PCs on our network, only a handful have WMI issues.

I've adapted the script to automatically add the last failed machine to an exclude list - but currently have no way of killing the script if the process hangs. So... my question is...

Is there any way to either (1) automatically kill the scripts process if the process hangs or (2) kill the script with another external detection script, based on it hanging?

Ooh, good one for a tuesday morning! :)

Many thanks,

JT

Share this post


Link to post
Share on other sites



Yes you can set up a poll and do it that way or Adlib to do that for you on each one of the PC's


Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

Share this post


Link to post
Share on other sites

Might try using 2 scripts.

1. Main script, on startup get a list of AutoIt windows, match their PIDs to your newly launched app.

2. Once you find the right Hwnd, send that in a command line to the "watcher" app.

3. In the watcher app, loop through using a dll call for IsHungAppWindow : http://msdn.microsoft.com/en-us/library/ms633526(VS.85).aspx

I could have sworn someone wrote something up for checking if a process is hung, but my search terms may be incorrect... I thought I remembered them using GetProcessIOCounters but that search didn't turn it up either.

Any, the quickest solution I can think of off the top of my head above.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

hi there, thanks for your responses.

Okay, i've only got one window which does everything - so getting the PID should be easy enough. I can call another autoit script and pass that ID - but how do I do the 'step 3' part within AutoIT?

Share this post


Link to post
Share on other sites

Well, just pass your PID (I was talking about window handles, not process id's... but let's do it with process id's that way you only have to pass @AutoItPID in the main app to the watcher).

(None of this is tested, just pseudo mainly):

Main App:

Run('"' & $s_Watcher_Location_Name & '" ' & @AutoItPID)
; Somewhere in here before you actually exit your main app
; Be sure to close the watcher appoÝ÷ Ùf­r«ZºÚ"µÍÈØ]ÚYÝ    ÌÍØÛY[VÌH[SÙÐÞ
M   ][ÝÑÜ][ÝË  ][ÝÖ[ÝH]ÝÜÈHÛÛ[X[[HÈYK][ÝÊBQ^]B[YÛØ[   ÌÍÚWÔQH ÌÍØÛY[VÌWK ÌÍØWÒÒ[ÂÛØ[ ÌÍØWÕÙÌHÜ[   ][ÝÕÙÌ  ][ÝÊBY    ÌÍØWÕÙÌHLH[^]YØÙÜÑ^ÝÊ   ÌÍÚWÔQ
H[^]ÂÛØ[ ÌÍÚXØË ÌÍÚØÛ  ÌÍØWÕÚ[ÝHÚ[Ý
    ][ÝÖÐÓTÔÎ]]Ò]×I][ÝÊBÜ    ÌÍÚXØÈHHÈ ÌÍØWÕÚ[ÝÌVÌBRYÚ[Ù]ØÙÜÊ    ÌÍØWÕÚ[ÝÉÌÍÚXØ×VÌWJHH  ÌÍÚWÔQ[BIÌÍÚØÛHÛ
    ÌÍØWÕÚ[ÝÉÌÍÚXØ×VÌWJBBQ^]ÛÜQ[Y^Y  ÌÍÚØÛH ][ÝÉ][ÝÈ[^]
Ú[HØÙÜÑ^ÝÊ   ÌÍÚWÔQ
BIÌÍØWÒÒ[ÈHØ[
    ÌÍØWÕÙÌ   ][ÝÚ[ ][ÝË  ][ÝÒÒ[ÐÚ[ÝÉ][ÝË    ][ÝÚÛ    ][ÝË  ÌÍÚØÛ
BRYÐ^J ÌÍØWÒÒ[ÊH[    ÌÍØWÒÒ[ÖÌH[BNÈ]ØÈØ]Ú[È]Z]ÜÛ[ÂBNÈ]ÛÛY][ÈHÈÂBNÈØÙÜÐÛÜÙBBNÈÙÈ]ËQ[YTÛY
L
BÑ[[ÈÛ]]Ò]^]

BRYÑXÛY
    ][ÝØWÕÙÌ][ÝÊH[ÛÜÙJ    ÌÍØWÕÙÌBNÈX^[ÈÙÈÛÛY][ÈB[[

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Thank you for your reply - thats really helpful. I'm going to have a play around with it and see if I can resolve the issue.

We noticed something else happening on the PC which is doing the scanning. It seems that after a couple of thousand PCs - the script starts bombing out all attempts to connect to anything with WMI (until after you reboot).

Hmmmm.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0