1833573 Members
3488 Online
110061 Solutions
New Discussion

I can´t kill a process

 

I can´t kill a process

I can´t kill a process. I tried with kill -9 and it didn´t response. The process is a Jboss app and what i can see is that it has some connections like this:
thuxwas0:/opt/jboss4.0.2/server/Sigma/log# netstat -an | grep 8380
tcp 0 0 10.250.0.71.8380 10.250.0.71.53013 CLOSE_WAIT
tcp 0 0 *.8380 *.* LISTEN
tcp 0 0 10.250.0.71.53013 10.250.0.71.8380 FIN_WAIT_2

I do´t know what i have to do to kill the process. The 10.250.0.71 ip is the server ip. It's a HPUX 11.11.

Regards, RIcardo
Mr.
7 REPLIES 7
James R. Ferguson
Acclaimed Contributor

Re: I can´t kill a process

Hi Ricardo:

If a process won't terminate using a 'kill -9' then it is in kernel code waiting on an event. A process waiting to complete an I/O is an example of one such situation.

You can try killing the parent process.

Regards!

...JRF...
spex
Honored Contributor

Re: I can´t kill a process

Hi Ricardo,

If the ppid is 1 (init), the process is an orphan. You will have to reboot to get rid of it.

PCS
Jaime Bolanos Rojas.
Honored Contributor

Re: I can´t kill a process

Ricardo,

If there is not way to kill it, then the only solution is the reboot, schedule a down time and you are done. Also if you can not schedule it, and is consumen a lot of your resources, reniceing the process also helps.

Regards,

Jaime.
Work hard when the need comes out.
Sheriff Andy
Trusted Contributor

Re: I can´t kill a process

Have you tried to close the port by using lsof or ndd?

ndd -get /dev/tcp tcp_status | grep (the ip or port #)

ndd -set /dev/tcp tcp_discon (the hex address)

Re: I can´t kill a process

Andy
I tried with ndd -get /dev/tcp an I just obtain "operation failed, Invalid argument" as result. When I execute lsof -i | grep 8380 (the port) I don´t get anything as result. Can you help me?

Regards
Ricardo.
Mr.
Sheriff Andy
Trusted Contributor

Re: I can´t kill a process

I worked this ndd with my boss yesterday so it is a little fresh in my memory. I can't take credit for this, but hope it helps. This has helped us in some instances, but you may still need to reboot.

Use caution when running this and make sure you have the correct port.

did you run the;

# ndd -get /dev/tcp tcp_status | grep 10.250.000.071

0000000048dbc868 010.250.000.071 971b7b36 971b7b36 000043ec 000132d0 4a2798a4 4a2798a4 00008000 00500 01460 [359c,7f9] TCP_ESTABLISHED

0x48dbc868 in this case is the hex you need.

You can disconnect by;

# ndd -set /dev/tcp tcp_discon 0x48dbc868

If you can't run the ndd -get /dev/tcp tcp_status command, it may have to do with too many user connections open.

Hope that this helps.
Matthew Ghofrani
Regular Advisor

Re: I can´t kill a process

When netstat shows CLOSE_WAIT or FIN_WAIT it means that the process tried to disconnect but it is waiting for a response from the other side, another words each party is waiting for the other to acknowlege the good-bye but nothing is happenning. I do have a script that cleans all of them up.
@@@@@@@@@@@@@
#!/bin/ksh
# Hewlett-Packard Corporation
# This script is UNSUPPORTED. Use at own risk.
# @(#)$Revision: 1.3 $ $Author: scotty $ $Date: 98/08/25 17:55:01 $
#
# This script will query the system for any TCP connections that
# are in the FIN_WAIT_2 state and forcibly disconnect them. It
# uses netstat(1) to find the FIN_WAIT_2 connections and calls
# ndd with the correct hexidecimal representation of the connection
# to close the connection.
#

#
# Temporary files used to compare netstat output
#
MYSCRIPTNAME=${0##*/}
TMPFILE1=/var/tmp/$MYSCRIPTNAME.1
TMPFILE2=/var/tmp/$MYSCRIPTNAME.2

#
# Create a log file to keep track of connection that were removed
#
LOGFILE=/var/adm/$MYSCRIPTNAME.log


function getFinWait2 {

/usr/bin/printf "%.2x%.2x%.2x%.2x%.4x%.2x%.2x%.2x%.2x%.4x\n" \
$(/usr/bin/netstat -an -f inet | /usr/bin/grep FIN_WAIT_2 | \
/usr/bin/awk '{print $4,$5}' | /usr/bin/sed 's/\./ /g') > $TMPFILE1
}

function compareFinWait2 {

FIRST_TIME=1

cp $TMPFILE1 $TMPFILE2
getFinWait2

comm -12 $TMPFILE1 $TMPFILE2 | \
while read CONN
do
if [[ $CONN != "000000000000000000000000" ]]
then

if [ $FIRST_TIME -eq 1 ]
then
print >> $LOGFILE
date >> $LOGFILE
FIRST_TIME=0
fi

print "/usr/bin/ndd -set /dev/tcp tcp_discon_by_addr \"$CONN\""
>> $LOGFILE
/usr/bin/ndd -set /dev/tcp tcp_discon_by_addr $CONN
fi
done

getFinWait2
}

#
# Main
#

touch $TMPFILE1
touch $TMPFILE2

compareFinWait2
@@@@@@@@@@@@@

Matthew From Boston
Life is full of bugs