Encounter errors while trying to kill a process

Hi everyone,

i have recently encountered a problem quite often (though not all the time) - “encountered errors while trying to kill a process”

Background info:

we have several robots running on our server. sometimes the robots encounter error while trying to kill SAP process but not always. The whole process stops because it runs into error in the “Init” state. I could not think of any possible explanations. Anyone else has an idea why?

Cheers

Hi,
In the Kill process activity enable the “Continue on Error” option, that will resolve this issue. Or check for the processes in the current session and then kill those alone. Don’t kill all the processes from all session.

3 Likes

Okay, while trying to kill a Java app also I encountered similar difficulties.

Try ‘Close application’ with generous delay and timeOutMS and then wrap it with a try catch, and in Catch kill that exact process (get processes and if that process exist use kill process) with ContinueOnError property as true :slight_smile:

If you are still not able to end/close that app then use a powershell/CMD prompt to end/stop the service and try again the above process. This should work because it has never failed me though.

3 Likes

HI @Raghavendraprasad - do you have any xaml code for these steps you described? I have encountered the same issue.

@miketong44 - is this issue resolved?

@sarathi125 - how to check the processes in the current session?

UiPath ReFramework 101: Killing a User-Specified Process | Aggranda

Check this out. This may solve your issue. Maybe you Kill process is trying to kill a process which would be open by another user and you current user does not have the rights to kill that particular process.

Althought, the “ContinueOnError” check on the Kill Process activity would also solve your issue as well.

Cheers.

2 Likes

Check if the process you want to kill is running or not? if running, then kill the process.

How to check if process is running or not?
Process.GetProcessesByName(prc).Count > 0

If true, Kill the process else do nothing.

3 Likes

if nothing from the above worked .
surround the kill process activity with try catch and it will catch the exception and keep running