Jump to content
Sign in to follow this  
bluespirit

Invalid UNC path freezes scripts

Recommended Posts

bluespirit

Hi,

I'm writing a script to copy a number of files from UNC paths. That bit is pretty simple. However, my users think my script has crashed, which it hasn't, it's only because the UNC path doesn't exist and one of the AutoIt functions is waiting. This is true of FileExists(), FileCopy(), DriveStatus(), etc.

Is there a function to check if a UNC path exists that doesn't pause in this fashion?

The only way round it, that I can think of at the moment, is to spawn another process and pre-check all the UNC paths and write if they exist in a text file. Then rather than use FileExists(), I use my text file instead.

Anybody got a better idea?

Thanks,

James

Share this post


Link to post
Share on other sites
jchd

You're are not in a domain, are you? I doubt pre-checking things would make the whole process more responsive.

The problem is probably not linked to AutoIt but instead has its root in how a peer LAN (without a domain) works. I guess your script is not hung, and that the AutoIt functions (which are likely more or less simple wrappers around Windows calls) are simply waiting for Windows function to return.

I've had a number of such irritrations when Windows decides that there is no more a Master Browser (Google for that) and it has to proceed to a Master Browser election. In MS parlance that means _almost_ locating a PDF (virtual to save trees) printer, print election bulletins, distribute them to the whole network where some computers can be badly drunk and sleeping hard, wait for the election results, proclaim the new King lound and pass the LAN crown to the newly elected Master Browser, which can only then decide which address the server you request has...

Of course all of this takes time, but I'm not sure that AutoIt is to blame here. There are many more details hidden, like the use of LMHOST defs, and more.

BTW, most MS peer LANs work without Master Browser, which is something I find funny. I may be off somewhere in the above pseudo-rationale but the only thing to know is that a MS peer LAN can take much time to answer initial request on/for a given server. This is part of a long tradition of MS network protocols to be unreliable, slow, ineffective and completely off any standard. But as a long-term Windows users you and me now have some hard time finding that abnormal :)

Of course, enterprise networks don't work this way!


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
bluespirit

Funny you should mention enterprise domains as that is what the script is running on. All the valid UNC paths return immediately. It's the invalid ones that take their time before giving up.

As you say, it's not an AutoIt issue, but a Windows one. I'm trying to find a creative way around the problem. The method I mentioned wouldn't be any quicker, it's just it would be another script running in the background gathering all the required information that the user wasn't aware of. The main script could then reference that information to get a quicker response than asking Windows direct. What do you think?

Share this post


Link to post
Share on other sites
jchd

Sorry I don't have good AD experience to help you on this.

I thought that a correctly setup domain would tag invalid UNCs right away, and all large corp MS networks I've seen used to work (or rather fail) decently fast in such case, but this is outdated experience. All trolling about MS apart, I suspect there should be settings in your DC to rule out bad UNCs quickly but it may need to determine what is causing the delay: bad server, bad path, bad rights.

BTW, good UNCs & rights are sometimes causing the same irritating delay issue on a MS peer LAN. Hence my mention of Master Browsers. But this is probably unrelated to your situation.

I hope someone more knowledgeable will take over the issue and offer a smart and solid solution.

I whish you best of luck.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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  

  • Similar Content

    • Tersion
      By Tersion
      Here test example:
      The code is not prefect, but it's demonstrates the problem.
      So, when I download more than 2 files simultaneous from one server (in my example I download 3 simultaneously) by InetGet() with background option, I will get only 2 active downloads. It's seems like server limitation. The third will remain with 0 read bytes until one of the previous downloads would finished. And if I want to close this third 0 bytes read download with InetClose() I will get hang of Window GUI for several seconds! After that, the third download would be closed and everything will continue to work normally.
      If I InetClose() one of the active downloads with more than 0 bites read - all works fine!
      You can try by your self given example, or watch this .gif's:
      1. Window GUI hangs when I trying to Cancel (InetClose()) download with 0 bytes read download:

      2. All works as it should, when I Cancel more than 0 bytes read download:

      Any ideas why is it happens?
    • Blueman
      By Blueman
      Hi all,
      I was wondering if you can help me with the function called; InetRead().
      My scripts are using this function a lot for several conditions and everything works fine!
      But sometimes when the server is a little bit buggy of simply not available my script is hanging.
      It takes about 90sec before this function returns a Timeout, when i adjust the parameter it still is hanging about 90sec.
      The following script is a example where the script is hanging for aprox. 90sec;
      ; Set Timeout to 2sec AutoItSetOption ("TCPTimeout", 2000) ; Read Website InetRead("http://www.geenverbinding.nl/",1) ; Show Msgbox before Ending Script. Msgbox(64,"","Finished")  
      The following script is a example where the script show the Msgbox pretty fast;

       
      ; Set Timeout to 2sec AutoItSetOption ("TCPTimeout", 2000) ; Read Website InetRead("http://www.google.nl/",1) ; Show Msgbox before Ending Script. Msgbox(64,"","Finished")  
      My question now is, what am i doing wrong and/or is there a other way to prevent Hanging the script?
      Thanks all
       
    • rudi
      By rudi
      Hi,
      any suggestion to track down, why a script is freezing after a longer run time?
      This is a general question, I've checked the common mistakes, I've made so far (inside a loop doing fileopen() without fileclose(), runwait() for progs, that don't terminate, infinite recursive loops etc.)
       
      This script stops just after several days of running...
      Is  there a direct way to "count" the amount of MEM and handles, a autoit script is using itself, or by child processes?
       
      Regards, Rudi.
    • Shedunn
      By Shedunn
      I recently installed AutoIT(the most recent version) on my work computer and everytime I try to use Koda to generate code for a GUI Koda freezes....nothing can be clicked on and I have to use task manager to end the task.  It doesn't seem to matter if I open a file or if I try with a fresh design.  It also freezes if I try to change any settings within Koda

      I've tried uninstalling everything AutoIT related and reinstalling and restarting the computer.  No matter what it still does it
       
      Is there a setting somewhere that could be causing this?
×