When __TIMESYNC__ is enabled, main() forks a child to run clock_worker():
if (fork() == 0) {
clock_worker();
}
If clock_worker() encounters an error (socket creation fails, bind() fails, or recv() fails), it returns. Because there is no _exit() after the call, the child process falls through and continues executing the rest of main(). This causes it to:
- Fork again at line 1214, creating an unintended grandchild process
- Attempt to execute the workload via
execvp(), duplicating it
- Enter the
waitpid() loop in the parent branch, interfering with process lifecycle management
The impact is that any transient failure in timesync setup silently causes the workload to be launched twice, which may produce difficult-to-diagnose issues ranging from port conflicts to corrupted state.