Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Win32::OLE->Getobject hangs??

Reply
Thread Tools

Win32::OLE->Getobject hangs??

 
 
bubslg
Guest
Posts: n/a
 
      09-12-2007
I've got a script that goes through a list of servers and grabs dirve
info from them. The script usually works fine except when it hits a
server that WMI is acting goofy on.

Out of a list of ~250 servers, this call will hang on 2-3 servers.
$WMIServices = Win32::OLE->GetObject("winmgmts:
{impersonationLevel=impersonate}!//$Server/root/cimv2")

Any ideas how to get around this? Is ther a way to force this call to
timeout and move on?

Thanks

 
Reply With Quote
 
 
 
 
Brian McCauley
Guest
Posts: n/a
 
      09-13-2007
On Sep 12, 11:15 pm, bubslg <bub...@gmail.com> wrote:
> I've got a script that goes through a list of servers and grabs dirve
> info from them. The script usually works fine except when it hits a
> server that WMI is acting goofy on.
>
> Out of a list of ~250 servers, this call will hang on 2-3 servers.
> $WMIServices = Win32::OLE->GetObject("winmgmts:
> {impersonationLevel=impersonate}!//$Server/root/cimv2")
>
> Any ideas how to get around this? Is ther a way to force this call to
> timeout and move on?


Have you tried the usual approach? I suspect it won't work in this
case but it's worth a shot.

(See FAQ: "How do I timeout a slow event?")

 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      09-13-2007

Quoth Brian McCauley <>:
> On Sep 12, 11:15 pm, bubslg <bub...@gmail.com> wrote:
> > I've got a script that goes through a list of servers and grabs dirve
> > info from them. The script usually works fine except when it hits a
> > server that WMI is acting goofy on.
> >
> > Out of a list of ~250 servers, this call will hang on 2-3 servers.
> > $WMIServices = Win32::OLE->GetObject("winmgmts:
> > {impersonationLevel=impersonate}!//$Server/root/cimv2")
> >
> > Any ideas how to get around this? Is ther a way to force this call to
> > timeout and move on?

>
> Have you tried the usual approach? I suspect it won't work in this
> case but it's worth a shot.
>
> (See FAQ: "How do I timeout a slow event?")


I thought of mentioning that, but it definitely won't work under any
version of Perl which uses safe signals: even if the signal is
delivered, perl won't check for it until after the XSUB returns.

The correct answer is to write a bit of XS to call
IMoniker::BindToObject (which is the what GetObject ends up calling)
with a IBindCtx specifying a timeout; but that's a job for someone who
knows more about COM than I.

I don't know of any way to break Perl out of an XSUB which has hung. The
only solution I can see (short of fixing Win32::OLE to allow timeouts)
is to perform the GetObject in a new thread, and detach that thread (and
let it fail in its own good time) if you time out. However, I don't know
how well Win32::OLE plays with threads.

Ben

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57