karmayogi Posted January 14, 2011 Share Posted January 14, 2011 (edited) HelloI have a small piece of AutoIt code that essentially invokes a batch file using the RunAs call. The exe that I create out of this script is being invoked from a Windows Serviceon a Windows 2003 box. Every once in a while the RunAs fails to launch the process and returns back with various garbage return codes and I can see that once it goes into such a state no matter what I do or what command I try to launch, it is stuck. The only way to recover is to actually restart the machine.Has anyone encountered this issue before?I can recreate this on any 2003 machine after a few runs. Also I have tried this using AutoIt version: 3.3.0 and 3.3.6.1. Both exhibit the same behavior.This is my code sampleLocal $pid = RunAs($sUser, $sDomain, $sPassword, 0, @ComSpec & " /c " & """" & $sCmd & """", $sTempDir, @SW_HIDE, 0x10) Local $perrCode = @error Local $retVal = ProcessWaitClose($pid, $processTimeout) $errCode = @extendedAppreciate any pointers /helpThanksYogi[[update 01/21/2011]]After quite a bit of digging and process level exploration, I think the RunAs function in AutoIt is leaving behind some resource and clogging up the machine. Thats why after a few runs, I see the machine not able to launch any more processes as another user. Is there a way I could look at the source code for the RunAs feature to see if I can help troubleshoot and fix this issue? Edited January 21, 2011 by karmayogi I came, I saw and I copied. Link to comment Share on other sites More sharing options...
Darknight1366 Posted January 15, 2011 Share Posted January 15, 2011 You've used some wrong command in this code which are not created by Autoit.(e.g.@extended) And your Script is Uncompleted too. Use another element. Visit HugeSoft(TM) To Get Any Coding Help or Anything Link to comment Share on other sites More sharing options...
karmayogi Posted January 21, 2011 Author Share Posted January 21, 2011 (edited) [[update 01/21/2011]] After quite a bit of digging and process level exploration, I think the RunAs function in AutoIt is leaving behind some resource and clogging up the machine. Thats why after a few runs, I see the machine not able to launch any more processes as another user. Is there a way I could look at the source code for the RunAs feature to see if I can help troubleshoot and fix this issue? #DarkNight... sorry buddy your answer did not make any sense to me. @extended is an autoit construct by the way Edited January 21, 2011 by karmayogi I came, I saw and I copied. Link to comment Share on other sites More sharing options...
Valik Posted January 21, 2011 Share Posted January 21, 2011 Resource leak is very obvious. You are using STDIO redirection but fail to actually trigger any condition which will allow the streams to close. The streams can automatically close if it is detected they are no longer used. This condition is not met. You can forcibly close the streams by using StdioClose() which is not present in your code. There's no AutoIt bug here, only poorly written code that ignores the documentation. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now