I have a program (C++) that works with TCP sockets in multithreaded manner. The multithreading is intensive, about 100 threads (POSIX threads).
Sometimes, not quite sure when, the program gets terminated by
SIGTERM. After some googling I found out that it is not normal for system to send
SIGTERM. I've decided to look what happens if I ignore the signal. Now the system sends
SIGKILL. I assume it tries with
SIGTERM and when the application does not terminate, the system kills it.
I have tried running it in gdb, and got no signals.
I've run it in valgrind, no signals. No valgrind errors either. Memory consumption was normal, it seems I have no memory leaks. Upon exit it had 7Mb heap in use.
Nothing suspicious in
The system is Debian 2.6.32-5.
Basically, the question is why may the system send
SIGTERM followed by
SIGKILL to an arbitrary process? And how can I stop at that point to see what happens (gdb alters the behavior).