veyron/examples/tunnel/tunneld: Ensure that the spawned process is killed if the client exits.

Prior to this change, it was possible for the tunnel client (e.g. vsh) to exit while the
process spawned on behalf of the client continues to live. For example, the following
sequence of events would leave garbage "vim" processes on the server:

1) go install veyron/examples/tunnel/...
2) ./bin/tunneld --acl='{"*":"RWA"}' --address=localhost:0
3) ./bin/vsh -t <name_of_tunneld_service_printed_in_logs_from_command_above> vim
4) (from another terminal, kill the "vsh" process)
With the above sequence, a simple "ps" would show the "unowned" vim process
lying around. Repeating steps (3) and (4) could be used to leave many processes
around. Furthermore, after (4), trying to interrupt the tunneld server
(e.g. sending it a SIGINT with Ctrl+C) would result in the tunneld server
just hanging around (presumably, waiting for the hanging "Shell" RPC to exit).

(I haven't confirmed, but I think that the reason runIOManager does not
exit even though "vsh" has been killed and the underlying network connections
broken is because stream2stdin is stuck in stdin.Write, so it does not
notice the closed RPC stream).

With this commit, a dead tunneld-client results it all processes spawned
for it being terminated.

Change-Id: I6ed493e84fa6f156f37ab7e53beb9fdfb2878939
2 files changed
tree: 76d0681bf81545b42166904fc5b29b43cd895d09
  1. examples/
  2. lib/
  3. products/
  4. runtimes/
  5. security/
  6. services/
  7. tools/