I have a java process that cannot be killed. I have tried every method I know, or that I have found on the internet to no avail. I have tried:

killall java
kill -9 <pid>
kill -11 <pid>
kill -6 <pid> 

No matter what I try, I cannot kill the program. If this helps, it has a dynamic PID, and this has happened before and I somehow killed it last time.

  • are you sure you are using the correct PID? – amphibient Jan 14 '13 at 21:19
  • 1
    Are you sure the program is still alive and not a zombie? BTW: There is usually no reason to kill -9 a process. Sending a SIGTERM, then SIGQUIT or SIGINT should make the program quit. If it doesn't it's buggy. – Marco Jan 14 '13 at 21:19
  • 3
    It's also worth noting that it's often impossible to kill processes that are currently waiting on I/O. – tink Jan 14 '13 at 21:21
  • Disagree with Marco about the use value of SIGKILL and the assertion that a program that responds to that but not SIGTERM is "buggy". $0.02 – goldilocks Jan 14 '13 at 21:27
  • 1
    @goldilocks A program cannot respond to SIGKILL. Usually you want to give the program a change to clean up (close files, network connections, etc) and then exit and that's what SIGTERM is for. If you tell a program to terminate and it refuses, it's a bug! SIGINT or SIGQUIT should not be necessary, but some programs respond to the signals and exit immediately. SIGKILL is only useful if you want to prevent the program from cleaning up or in the rare case it got stuck in the clean-up code. – Marco Jan 14 '13 at 21:57

It's rare but possible for processes to end up in a D (uninterrupted sleep) state and they cannot be killed. You can check with:

ps -o cmd,stat -p <pid>

If the STAT is D, that's the issue.

If not I suggest you add some more information to your post such as exactly what the process is, what it is doing, and why you want to kill it.

| improve this answer | |
  • 1
    Most of the time this is due to faulty hardware, a kernel bug, or issues with network storage such as NFS. – jordanm Jan 14 '13 at 21:39
  • Yes -- a failing hard disk would be a possble cause. If there are bad blocks somewhere the JRE in particular wants access, that would do it. – goldilocks Jan 14 '13 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.