commit | 567e434101d60ef865aa55b1f6539a7c539ef872 | [log] [tgz] |
---|---|---|
author | bazel.build machine account <15028808+bazel-io@users.noreply.github.com> | Thu Mar 07 00:35:18 2024 +0100 |
committer | GitHub <noreply@github.com> | Wed Mar 06 23:35:18 2024 +0000 |
tree | fe956cf1513c459889be52df489bd5aca1243ea9 | |
parent | c43ace2a9644c262be41c0d25c867161d7cfd903 [diff] |
[7.1.0] Attempt to fix cancellation crash in repo fetching w/ worker thread (#21599) The stacktrace in https://github.com/bazelbuild/bazel/issues/21478 suggests that the second `workerFuture.get()` (line 183 before) is snagging on a `CancellationException`. Closer inspection indicates that the exception handling in this entire block of code is just faulty -- one, `workerFuture.get()` on line 169 is very unlikely to throw an `InterruptedException` because this call happens after we've received a `DONE` from the signal queue, which is at the very end of the worker thread logic (in its own `finally` clause, actually); two, the second call to `workerFuture.get()` on line 183 doesn't actually do anything because `get()`-ing a cancelled future would just throw a `CancellationException` immediately. This CL attempts to fix these two glaring errors. It now tries to handle interrupts where it's likely to happen, which is at the call to `state.signalQueue.take()` -- this is where the Skyframe thread spends the most time blocked, and where a Ctrl-C from the user is most likely to land. We catch an `InterruptedException` here and interrupt the worker thread. To wait for the worker thread to finish, we uninterruptibly take from the signal queue instead of calling `workerFuture.get()`. Additionally, we now correctly handle the worker thread being interrupted by someone other the host Skyframe thread (the memory pressure handler, in all likelihood), by simply retrying the fetch instead of crashing Bazel. Fixes https://github.com/bazelbuild/bazel/issues/21478 (maybe...?) Commit https://github.com/bazelbuild/bazel/commit/fd769f0211b7039ee7ccafe852dd1f8da828c8d6 PiperOrigin-RevId: 613348046 Change-Id: I692fa750cb8873f1bd403f16764d1845410a29f1 Co-authored-by: Googler <wyv@google.com>
{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:
To report a security issue, please email security@bazel.build with a description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue. Our vulnerability management team will respond within 3 working days of your email. If the issue is confirmed as a vulnerability, we will open a Security Advisory. This project follows a 90 day disclosure timeline.
See CONTRIBUTING.md