Page 1 of 1

Killing process left running from aborted job

Posted: Mon Sep 05, 2005 6:01 am
by sasidhar_kari
Hi All,

How to kill a process using Unix.
I need to kill the process for the aborted job without using the Datastage Director.

Thanks in Advance

SAS

Posted: Mon Sep 05, 2005 7:11 am
by roy
Hi,
Usually you would like to do this using the director or the DS.TOOLS interface from the universe command line.
If you insist using unix command line you will kill the process but might not release DS locks and such.

I will use the unix kill command as a last resort starting with kill -15 then -13 then -11 and finally -9 (the last option -9 kills immidiatly without giving the process any chance to cleanup after itself) and the process id of the process you want to kill.
Bare in mind you usually have permissions to do this to jobs owned by the user you logged in under unless you are the administrative user (root).

I strongly recomend you consult this issue with your sysadmin guys, and undestand the implications of using this command before you use it.

P.S.
please update the DS version and OS related info of your post.

IHTH,

Posted: Mon Sep 05, 2005 7:30 am
by venkat n
Hi Sasi,

When you want to kill a process/job first you have to find out the process ID which are currently running on datastage server
I would like to prefer to connect to your server via telnet with your ID
and then use ps -ef command
which gives the current processes which are running on your server by that you can find out the process ID
then kill your ID based on kill command

Posted: Mon Sep 05, 2005 7:34 am
by venkat n
when you are using ps -ef command that give output as
UID PID PPID C STIME TTY TIME CMD
root 1515 1 0 May 08 ? 0:00 /dstage/app/DataStage/DSEngine/bin/dsrpcd
dsadm 1984 1515 0 10:17:36 ? 0:00 dscs 4 3600 0
dsadm 1985 1984 0 10:17:36 ? 0:03 dsapi_slave 7 6 0
dsadm 2102 1515 0 May 08 ? 0:00 dscs 4 3600 0
dsadm 2103 2102 0 May 08 ? 0:03 dsapi_slave 7 6 0
then you can kill the procee which you want
We can kill the processes that got left behind. This usually happens if there is a network problem or if the client hangs and is terminated. You can specify multiple Process IDs (PID) on one "kill -9" command.
$kill -9 1984 1985 2102 2103
but first of all I won't prefer kill -9 command. because this is very dangerous command.

Posted: Mon Sep 05, 2005 7:36 am
by venkat n
after killing the session you have to check
Check to see if the kill command worked or not
by again ps -ef command
UID PID PPID C STIME TTY TIME CMD
root 1515 1 0 May 08 ? 0:00 /dstage/app/DataStage/DSEngine/bin/dsrpcd

Posted: Mon Sep 05, 2005 7:58 am
by chulett
venkat n wrote:but first of all I won't prefer kill -9 command. because this is very dangerous command.
Well, then don't use it in your example. :wink: Many people will just look at an example and run with it without reading any of the dire warning that follow.

Also, if one wants to kill off leftover running job processes - you should be looking for phantom processes on the server. The dscs and dsapi_slave processes are client connections and you could be needlessly blowing others (or even yourself) out of the water!

Code: Select all

ps -ef |grep phantom |grep -v grep
Leave all that other process killing for the times when you need to bring the DSEngine down and you can't find any other way to log old connections out.

Posted: Mon Sep 05, 2005 4:23 pm
by ray.wurlod
Warning!!

A job consists of more than one process. For server jobs there is one process (executing DSD.RUN) controlling the job and zero or more other processes (executing DSD.StageRun) which are child processes of the controlling process. Find and kill any child processes before killing the controlling process, lest you create UNIX zombie processes (which are very hard to kill!).

Posted: Mon Sep 05, 2005 7:22 pm
by chulett
True - but that's pretty much "Killing Processes in UNIX 101" and not anything specific to DataStage. :wink:

Posted: Wed Mar 07, 2007 8:38 am
by Triton46
Does the dslockd process clean these up?

We have a bunch of them hanging around my userid from network disconnects and oracle aborts on pl/sql.

How can I automate cleanup?

Posted: Wed Mar 07, 2007 12:49 pm
by ray.wurlod
$DSHOME/bin/dsdlockd -p executed as superuser

Posted: Thu Mar 08, 2007 4:08 am
by srinagesh
Hi Ray !

Code: Select all

$DSHOME/bin/dsdlockd -p

This doesn't seem to get rid of phantom processes.

I have 110 phantom processes, and I have run this command abt 1/2 hr back, still the processes remain.

In the director, the entries for these phantom processes have the LastCommandProcessed as " DSD.OnAbort"

Is there any other way to get rid of these phantoms (other than kill -9 option)?

-Nagesh

Posted: Thu Mar 08, 2007 4:32 am
by kumar_s
dsdlockd can be used only for those process which are left orphaned.
For those one which are active need to be first stopped from Director.
Resource Cleanup, Clear Status, DS.TOOLS from TCL, Kill can be followed.

Posted: Thu Mar 08, 2007 4:50 am
by srinagesh
Hi Kumar,

If we call a process which doesnt have any parent process (ie., having Parent process as 1) as an orphaned process, then all the 110 odd phantoms are orphaned.

Code: Select all

nagesh  1076     1  0   Mar 01 ?        0:01 phantom DSD.StageRun SRQCGenerator.HTB SRQCGenerator.Transform 299 0/50/1

This process from March 1st should have been taken care by dsdlockd, but it is not the case.

Any clues ?? :?:

Posted: Thu Mar 08, 2007 4:57 am
by kumar_s
What is the value of dsdlockd.config that avialble in $DSHOME?
Try configure the Timerto 900, it should pretty much take care automatically.
If that was set properly and if you still find many process left orphaned, close all the Datastage session and ensure there is not locks held by any clients. This can be easily found from "CleanUp Resources" option available in Director. Operate with dsadm, to clear any locks.
You can kill the rest of the process. Periodic restart of server would also take care of all these.