WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: erezpaz on October 17, 2021, 09:31:26 AM

Title: Exit does not exit
Post by: erezpaz on October 17, 2021, 09:31:26 AM
Hi

I have a big automation script that run in schedule. If my script detects that the process is up it wont start.
In some cases that I cannot restore, script get to the end with an "Exit" command but the process stay up. Next schedule run wont start since previous process is stuck.
Is it something that you heard of and can be solve?
I debug my script and there are no bugs. Also I got detailed log so all process run fine, It just sometimes does not exit.

Thanks
Title: Re: Exit does not exit
Post by: cssyphus on October 18, 2021, 07:24:38 AM
Not to nitpick, but we must understand in order to assist.

What do you mean by "the process"? 

What does this mean: "If my script detects that the process is up it wont start"

And what does this mean: "but the process stay up"?  What process?

Is your script compiled?

When you debug your script, do you use DebugTrace() ?  If so, do you have any user-defined functions or subroutines? If so, do you use DebugTrace(22) inside of them (to continue the debugger inside the function/subroutine)?

Are you able to post a DebugTrace log file?
Title: Re: Exit does not exit
Post by: td on October 18, 2021, 07:32:58 AM
Quote from: erezpaz on October 17, 2021, 09:31:26 AM
Hi

I have a big automation script that run in schedule. If my script detects that the process is up it wont start.
In some cases that I cannot restore, script get to the end with an "Exit" command but the process stay up. Next schedule run wont start since previous process is stuck.
Is it something that you heard of and can be solve?
I debug my script and there are no bugs. Also I got detailed log so all process run fine, It just sometimes does not exit.

Thanks

There is too much information missing to provide much in the way of suggestions. For example, you state that you run the script on a "schedule". Does that mean that you are using the Windows Task Scheduler? If so, you can configure Task Schedular to terminate a task after a specified amount of time. Are you using DebugTrace to generate your logs or are you talking about the Task Scheduler history logs?

And yes the Windows Task Scheduler can be a bit flaky and not allow tasks to terminate themselves from time to time. Otherwise, not properly closing down external COM Automation objects or a child process can cause the OS to block a process terminating itself.