Changeset 39467

Timestamp:
Sep 21, 2007, 10:38:17 PM (15 years ago)
Author:
Noel Belcourt
Message:

Another patch to fix the -lx timeout code. Some actions spawn
sub-processes after bjam forks a new process (for example, after
g++ is forked by bjam, g++ then forks sub-processes like cc1plus).
The timeout code would kill the g++ process, but might not kill
the subprocesses spawned by g++.

I fixed this problem by making the bjam fork'ed process (g++) a
session leader by calling setsid() before calling exec. The setsid
call, in essence, gives all child processes a parent process id
(ppid) of the g++ process id. This guarantees that killing g++
will kill all child processes spawned by g++ as well.

One last comment on the maximum process time before a process is actually
killed. The worst case process elapsed time is 2x seconds if -lx is
given. The reason is that a process might be one second away from being
killed and, if there's no other signal activity, the select function will
wait x seconds before timing out and killing any active processes. So
if you say -lx and monitor a build known to have lengthy processes, you
may see a process with up to 2x seconds of time before it is killed.

(No files)

Note: See TracChangeset for help on using the changeset viewer.