In this lesson, you will learn how to verify that asynchronous signals are correctly sent and received across process boundaries.
Understanding Signal Propagation
When you send a signal (like SIGINT or SIGTERM) to a process, it doesn't always go where you expect, especially when dealing with complex process groups or subshells. "Signal propagation" refers to the journey of that signal from the sender through the kernel to the destination process.
Often, a signal sent to a terminal session or a process group gets trapped or lost due to how the environment is structured. To debug this, we use the strace utility, which we explored in Lesson 13. By tracing the kill system call in the sender and the signal handler in the receiver, we can see exactly where the communication breaks down.
Observing the Path
Imagine you have a background process that isn't shutting down when you send a termination signal. To debug this, you can attach strace to the receiver to watch for the signal arrival:
# In one terminal, attach to the target process ID
strace -p 1234 -e trace=signal
# In another terminal, send the signal
kill -TERM 1234
If the receiver is "orphaned" (Lesson 12) or running in a different process group, the signal might be blocked or ignored by the process logic. If you see the signal appear in the strace output but the process remains active, you know the signal was delivered successfully by the kernel, but the application is failing to handle it. Conversely, if you see no trace of the signal at all, you have confirmed that the signal is failing to propagate through the process boundaries due to permission issues, incorrect process group targeting, or session-level isolation.
By isolating whether the failure occurs during transmission (the signal never arrives) or reception (the signal arrives but triggers no action), you can quickly determine if you are facing a system-level configuration issue or an application logic bug.
Key Takeaway: Use strace to confirm whether a signal is successfully traversing the gap between processes or if it is being blocked by the target process's internal environment.