Killing process left running from aborted job

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
sasidhar_kari
Premium Member
Premium Member
Posts: 62
Joined: Wed Dec 08, 2004 2:26 am

Killing process left running from aborted job

Post 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
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post 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,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
venkat n
Participant
Posts: 29
Joined: Fri Mar 18, 2005 3:28 am

Post 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
venkat n
Participant
Posts: 29
Joined: Fri Mar 18, 2005 3:28 am

Post 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.
venkat n
Participant
Posts: 29
Joined: Fri Mar 18, 2005 3:28 am

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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!).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

True - but that's pretty much "Killing Processes in UNIX 101" and not anything specific to DataStage. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Triton46
Charter Member
Charter Member
Posts: 83
Joined: Fri Feb 07, 2003 8:30 am

Post 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?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

$DSHOME/bin/dsdlockd -p executed as superuser
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
srinagesh
Participant
Posts: 125
Joined: Mon Jul 25, 2005 7:03 am

Post 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
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
srinagesh
Participant
Posts: 125
Joined: Mon Jul 25, 2005 7:03 am

Post 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 ?? :?:
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply