|Think about Loose Coupling|
what are the common causes of "system" command failure on Vistaby Workplane (Novice)
|on Apr 03, 2013 at 10:22 UTC||Need Help??|
Workplane has asked for the
wisdom of the Perl Monks concerning the following question:
Hello all. Thanks in advance for your help.
I have a Perl programme which makes "system" calls.
The problem is that sometimes the "system" fails with a return value of -1
What are the reasons that a "system" command might fail?
I am running on Vista64 SP2.
Perl is revision 5 version 12 subversion 1
I am logging in remotely to the Vista machine, I believe no other significant processes are running.
I'm only running one instance of my programme on each machine.
Task manager says all the CPU are at 0% before I start.
Apart from the few files which are opened and closed before the "system" everything is local.
The machine has 12 G of physical memory and more processors that you can shake a stick at (OK, 6 dual core)
It is a Dell T5500.
The programme opens and closes a few files and then runs the "system" command.
The external process started by "system" writes a lock file to C:\temp\ and deletes it at the end of its run.
The perl programme, waits for the lock file to exist, then not exist (ie the external process has finished), then starts another instance of the external progamme with "system" again.
The real external programme, is a big CAD system running a macro, but I have replaced it with a local batch file which waits a random number of seconds (between 1 and 20) then returns.
This dummy external programme does the same create and delete of a lock file.
I capture the output of running the external batch file to local files.
In general the process works!
But at some point I always get the system command returning -1 instead of the PID (of something) which it does normally.
If I get a -1, I sleep for 5 seconds and try the system again.
If I get 5 of these failures in a row, I give up and die.
I have never seen only 1 "system" command return -1. If I get a -1, then I get 5 in a row (and die)
So far this has happened after as few as 3 "system" commands.
The most I have seen is 63 successful system commands before one (and then 5) fails.
I'm doing this on 10 machines. All of them are displaying the same problem. They should all be the same in terms of hardware and software.
The .pl is held centrally (as opposed to locally).
I can't compile it because we don't have a compiler loaded and there is 0% chance of getting one or any module that I don't already have.
I have to use "system" not Win32::Process::Create because I couldn't get that to work with a bat file (only a exe).
I don't have Win32::Process:Info.
---> What are the common causes of "system" failing?
---> What can I do in my programme to capture things which will tell me what if causing it?
---> Is it safe to ignore these "system" failures and just keep sleeping and trying again?
The code around the system command is: