MOHAMED
MOHAMED

Reputation: 43518

Why "kill -15" fails sometimes?

I have a program developed in C. This program contains 2 sub threads. Some times, When I try to stop my application with kill -15 <pid of main thread> the application does not exit. And I can see only the pid of the main thread in the ps aux output (The pids of the subthreads are not displayed in the outpout of the ps aux). And keep killing the remaining pid with kill -15 <pid> does not cause the termination of this process. Only kill -9 <pid> will cause the termination of the process.

This behaviour happens 3 times in 1000 tries.

Please do not consider this topic duplicated with this one, because my program does not contain sigaction handler.

Upvotes: 3

Views: 274

Answers (1)

R.. GitHub STOP HELPING ICE
R.. GitHub STOP HELPING ICE

Reputation: 215257

It's not duplicate, but the answer is the same. Attach strace or gdb and see what it's doing when it's hung. However there are only two explanations: either you (or some library code you're using) blocked SIGTERM with sigprocmask, or the process is stuck in uninterruptable sleep in the kernel, which is usually a result of attempting to access a failing storage device like a dying hard drive or scratched optical disc.

Could you elaborate on what OS, kernel version, libraries, etc. you're using?

Upvotes: 2

Related Questions