Page MenuHomePhabricator

ExecFuture does not kill child processes on timeout
Closed, DuplicatePublic

Description

libphutil rPHU62f63fc614a15e05664b64ebe8c1ccd43e71a99d
O/S: FreeBSD 10.3-RC2

As far as I understood ExecFuture is used in various places with timeouts to make sure resources are restored. I have experimented with hanging unit tests that are spawned in child processes (infinite loops with sleeps) and it seems that proc_terminate does not kill these child processes, only the parent. The child processes are than reparented under init (PID 1). I think that this might be not what you want.

I have had this problem today after arc unit. Someone caused the server lag severely and the unit tests have finished already some time ago. There was a process with PPID 1 that was started during a unit test. The parent process was killed according to the logs, but the child continued to eat resources.

Steps to reproduce:

  1. Write a Makefile that you start with make in an ExecFuture. Let it start a subprocess in target all. This subprocess (a simple executable or script) should be something like for (;;) sleep(1); or similar.
  2. Use setTimeout(10) and resolve this ExecFuture.
  3. After make gets killed by the timeout, check if the infinite loop subprocess is running with ps xj. It is (for me at least).