aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/tools/process-tools.cc
Commit message (Collapse)AuthorAge
* Make process-wrapper output execution statistics for executed commands.Gravatar ruperts2017-11-28
| | | | | | | For example, it now outputs resource usage statistics like the amount of user time and system time used. RELNOTES: None PiperOrigin-RevId: 177263221
* process-tools: Fail silently when we can't install a signal handler.Gravatar philwo2017-05-26
| | | | | | | | | | | | | | | | | | | | | | | linux-sandbox expects InstallSignalHandler to fail silently when called for a signal that doesn't allow one to install a signal handler. This behavior was accidentally lost and changed into a DIE() on sigaction failure when unifying the signal handling code with process-wrapper in https://github.com/bazelbuild/bazel/commit/f5900474b8bce417c3ef4c3e06af6da5ed57b929. This CL restores the previous behavior. The issue results in this failure: $ linux-sandbox -- /bin/true third_party/bazel/src/main/tools/process-tools.cc:112: "sigaction": Invalid argument We do have tests for linux-sandbox and Bazel's usage of the linux-sandbox strategy. None of these actually started failing when the linux-sandbox stopped working, due to our automatic fallback logic that we added in order to not annoy users / CI on platforms that don't support the Linux sandbox :( Bazel silently falls back to the processwrapper-sandbox strategy and disables the entire linux-sandbox test suite, but signals to CI that it passed (because we don't support a "Skipped" test status). Well, congrats. What an epic fail. I will have to rework this next week. PiperOrigin-RevId: 157021455
* 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
* Remove process-tools.cc which I forgot to delete during the last rollback.Gravatar philwo2017-05-15
| | | | PiperOrigin-RevId: 156092500
* Check for definition of PR_SET_CHILD_SUBREAPER and don't die when it fails ↵Gravatar philwo2017-04-25
| | | | | | | | | in order to degrade gracefully on older Linux versions that don't support this feature yet. Fixes broken Bazel CI: http://ci.bazel.io/job/bazel-docker-tests/532/BAZEL_VERSION=latest,PLATFORM_NAME=docker/console PiperOrigin-RevId: 154190829
* 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