commit | 01c067a49fe24377636f844598fd1a0c27a1b158 | [log] [tgz] |
---|---|---|
author | jmmv <jmmv@google.com> | Fri Jun 05 04:30:27 2020 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Fri Jun 05 04:31:39 2020 -0700 |
tree | 6a9a7bdae8de27cdce6e3f557e605890ffff227a | |
parent | d06a5da7e9298516607cd8bac6892b189ac462c2 [diff] |
Make process-wrapper exit as soon as a timed-out process handles SIGTERM. Before this change, passing --timeout=X --kill_delay=Y would cause the process-wrapper to send a SIGTERM to the subprocess after X seconds... and then unnecessarily wait for Y seconds to send a SIGKILL. If the process exited after X passed but before Y expired, we wouldn't notice. The reason is that we were using kill(pid, 0) to check if the process had already vanished after a SIGTERM, expecting this call to return an error once the process is gone. The problem is: the process is never gone until a wait() is done, as otherwise it remains as a zombie, and sending signals to a zombie process doesn't return an error. Given that we cannot wait in the signal handler, make the signal handler install a second timer to send the SIGKILL once the Y seconds pass, and then let the main logic in the process-wrapper await for the subprocess' termination and finalization of the whole process tree. Part of #7818. RELNOTES: None. PiperOrigin-RevId: 314905347
{Fast, Correct} - Choose two
Build and test software of any size, quickly and reliably.
Speed up your builds and tests: Bazel rebuilds only what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.
One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.
Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.
Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.
Follow our tutorials:
See CONTRIBUTING.md