Kill a thread

We have a log when we generated thread dump

top - 03:46:28 up 6:00, 4 users, load average: 2.06, 1.10, 1.24
Tasks: 764 total, 1 running, 763 sleeping, 0 stopped, 0 zombie
Cpu(s): 34.1%us, 0.3%sy, 0.0%ni, 63.8%id, 1.7%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 12330528k total, 12162236k used, 168292k free, 224068k buffers
Swap: 12581880k total, 31488k used, 12550392k free, 1204648k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
16491 webmetho 20 0 11.9g 9.8g 31m R 97.9 83.6 0:38.73 java
16486 webmetho 20 0 11.9g 9.8g 31m S 0.0 83.6 0:00.00 java
16487 webmetho 20 0 11.9g 9.8g 31m S 0.0 83.6 0:00.23 java
16488 webmetho 20 0 11.9g 9.8g 31m S 0.0 83.6 2:06.17 java

We are restarting the server to kill the threads.

How to kill this particular thread without restarting the server.

Thanks
Sarath

Did you try kill -9

First find out the thread to which you want to kill. Use kill -3 to kill in a normal way, if you want to do forcefully then use kill -9 . Make sure you are killing correct thread if not it creates havoc environment

Thanks,

Hi all,

kill -3 will not terminate the process, but take a ThreadDump of the instance and keep the thread running.
kill -11 will take a core dump and terminate the instance afterwards.
kill -9 will terminate the instance without further action or notice (not really recommended except no other option helps)
killl -15 or just kill is the first option to try to terminate an instance.

@Sarath:
You should try to find out why your IS is behaving like that. Therefore it is neccessary to take several thread dumps (at least 3) at 1 minute interval for further analysis.

Which version of wM are you runnig on?
From wM 9.x there is a shutdown.sh in each components bin directory.
Use this to shutdown the instance in a normal way. This will also take care of stopping the instance if it is not responding to the shutdown requst in a reasonable time.

Regards,
Holger

Could you please list down the steps from where / and how to use these commands? Is it from webmethods directory?

I see shutodown.sh in IS directory. What parameters have to be passed.
Can you share a sample command.

Hi Sarath,

the shutdown.sh under IS/bin directory should be called without any parameters.

It checks for files under profiles/IS/bin to check if IS is started or not.
When IS is started then one of these files (wrapper.anchor) will be deleted which in turn causes IS to shutdown.
If IS is not shutdown in time it gets killed by the wrapper automatically.

Kill can be executed from any directory your currently in with the appropriate PID.

When taking thread dumps download the nohup.out from IS/bin-directory to your local box and download samurai.jar (a Java-based Thread-Dump-Analyser) from internet.

Remove all unneccessary overhead from the nohup.out:

  • all lines prefixed with anything like “wrapper” except “jvm1” (the one the thread dumps are in)
  • the prefix “jvm1” with all extra characters like pipe-symbol.

Double click on samurai.jar and drag the modified nohup.out file into the samurai window.
In one tabe there will be the imported nohup.out in plain text, in the second tab there will be a tabular overview of the threads in the thread dumps.
Check these fro any red or orange entries indicating waiting or blocked threads.
See the legend at the bottom of the table for explanations.

Regards,
Holger