0
votes

I have a C program running on Linux 3.12. This program spawns several child processes. One of these processes spawns a thread that runs for a bit then terminates. While this child process is running it performs an epoll_wait(). Periodically, the epoll_wait returns with an EINTR error. I setup the child process to catch the signal doing this interruption and found it is a signal 17, which, according to everything I have read is a SIGCHLD. Thing is, the thread this child process spawned is still running. It did not terminate. I also thought that threads do not generate a SIGCHLD on termination.

Any thoughts on why my process may be getting a signal 17?

1
1st you want to look up (grep through) your implementation's headers for which signal is represented by which number, or just simply write a ssmall program that prints out all (relevant) SIG* defines. Just rule out any guessing ... :-) - alk
Checked the headers and signal 17 is defined to be SIGCHLD. - tpotter01
Thread or process? Provide a minimal reproducible example with expected behaviour and how to reproduce the errorneous behaviour. - too honest for this site
A process spawns a thread and now the process is getting SIGCHLD signals and the thread is still running. The code is in excess of 25,000 lines so putting it here is not really practical. That is why I was asking a more generic question. Basically I would like to know are there other ways for a SIGCHLD to be sent other than the death of a child process. - tpotter01
Please show your code as a minimal reproducible example. There are multiple assertions and conclusions in your description which may or may not be true. The only way we can verify what you are saying is if the code is shown. And we do need to verify the behaviour you are asserting before we can even begin to explain it. - kaylum

1 Answers

1
votes

The answer is a call to system(). This function in the code spawns a process to execute the shell command being passed in. The thread was calling system() to run some shell commands. When they finished the processes that was spawned ended and generated the SIGCHLD.