aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/tools/process-wrapper.cc
Commit message (Collapse)AuthorAge
* Use getopt to parse process-wrapper's command-line.Gravatar philwo2017-06-22
| | | | | | | | This will allow us to add new and optional flags like selecting a strategy used to spawn / wait for the child process. No one except Bazel should be calling "process-wrapper" and I couldn't find any references, so this breaking change should be fine. PiperOrigin-RevId: 159685867
* Automated g4 rollback of commit 5608765ab737ebb8a98a04a6068143d53ae7065c.Gravatar philwo2017-06-06
| | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Rollforward with fix for FreeBSD. I added the missing headers and verified that it now builds fine on FreeBSD 11, too. *** Original change description *** Automated g4 rollback of commit 7f520a8286c39c5145b6d816cd0be5a6b7b18250. *** Reason for rollback *** This broke Bazel CI on freebsd: http://ci.bazel.io/view/Dashboard/job/Bazel/JAVA_VERSION=1.8,PLATFORM_NAME=freebsd-11/1516/console# *** Original change description *** Refactor process-wrapper code so the spawn/wait code is pluggable. In an upcoming change I'll reintroduce the new platform-specific implementations that can kill and wait for all descendant processes spawned by the wrapped process. This has no functional changes. PiperOrigin-RevId: 158133159
* Automated g4 rollback of commit 7f520a8286c39c5145b6d816cd0be5a6b7b18250.Gravatar elenairina2017-05-23
| | | | | | | | | | | | | | | | | | *** Reason for rollback *** This broke Bazel CI on freebsd: http://ci.bazel.io/view/Dashboard/job/Bazel/JAVA_VERSION=1.8,PLATFORM_NAME=freebsd-11/1516/console# *** Original change description *** Refactor process-wrapper code so the spawn/wait code is pluggable. In an upcoming change I'll reintroduce the new platform-specific implementations that can kill and wait for all descendant processes spawned by the wrapped process. This has no functional changes. PiperOrigin-RevId: 156884488
* Refactor process-wrapper code so the spawn/wait code is pluggable.Gravatar philwo2017-05-23
| | | | | | | | In an upcoming change I'll reintroduce the new platform-specific implementations that can kill and wait for all descendant processes spawned by the wrapped process. This has no functional changes. PiperOrigin-RevId: 156849610
* Share the signal handling code between linux-sandbox and process-wrapper.Gravatar philwo2017-05-19
| | | | PiperOrigin-RevId: 156347327
* Some fixes to process-wrapper / linux-sandbox.Gravatar philwo2017-05-19
| | | | | | | | | - Refactoring to share more code between the two programs. - Remove setuid() call in linux-sandbox. It was added due to a wrong understanding of what process-wrapper did in the beginning and unless someone installed linux-sandbox as a setuid binary, it was a no-op. - Switch to a new process group in linux-sandbox to avoid accidentally killing our parent. RELNOTES: None. PiperOrigin-RevId: 156332503
* Convert process-wrapper to C++.Gravatar Philipp Wollermann2017-05-17
| | | | | | | No functional changes. Change-Id: Ia87c19b70dd1ff8fa7465ad90c499cf351b9687b PiperOrigin-RevId: 156188343
* Automated g4 rollback of commit 3e5edafa2a04a71cd3596e929e83222da725f3f9.Gravatar philwo2017-05-15
| | | | | | | | | | | | | | | | | | *** Reason for rollback *** Likely cause for b/38172480 ("blaze now waits for all processes spawned by local tests to terminate") and b/38194553 ("Server terminated abruptly (error code: 14, error message: 'Endpoint read failed'"). I have a fix almost ready, but it consists of many lines of new code - we shouldn't rush that into Bazel's 0.5.0 release. Instead, let's roll this back, do a release using the known good older process-wrapper and then go forward in 0.5.1 with a better and well tested new version of this. *** Original change description *** process-wrapper: Wait for all (grand)children before exiting. This uses Linux's PR_SET_CHILD_SUBREAPER and FreeBSD's PROC_REAP_ACQUIRE features to become an init-like process for all (grand)children spawned by process-wrapper, which allows us to a) kill them reliably and then b) wait for them reliably. Before this change, we only killed the main child, waited for it, then fired off a kill -9 on the process group, without waiting for it. This led to a race condition where Bazel would try to use... *** PiperOrigin-RevId: 156068188
* process-wrapper: Wait for all (grand)children before exiting.Gravatar philwo2017-04-24
This uses Linux's PR_SET_CHILD_SUBREAPER and FreeBSD's PROC_REAP_ACQUIRE features to become an init-like process for all (grand)children spawned by process-wrapper, which allows us to a) kill them reliably and then b) wait for them reliably. Before this change, we only killed the main child, waited for it, then fired off a kill -9 on the process group, without waiting for it. This led to a race condition where Bazel would try to use or delete files that were still helt open by children of the main child and thus to bugs like #2371. This means we now have reliable process management on Linux, FreeBSD and Windows. Unfortunately I couldn't find any feature like this on macOS, so this is the only OS that will still have this race condition. PiperOrigin-RevId: 153817210