bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.15k stars 4.05k forks source link

interrupting `bazel fetch` crashes #13352

Open janakdr opened 3 years ago

janakdr commented 3 years ago
$ bazel fetch '@bazel_j2objc//...'
Loading: 0 packages loaded
    Fetching @bazel_j2objc; fetching
^C
INFO: Repository bazel_j2objc instantiated at:
  /usr/local/google/home/janakr/bazel/WORKSPACE:60:13: in <toplevel>
Repository rule http_archive defined at:
  /usr/local/google/home/janakr/bazel/tools/build_defs/repo/http.bzl:339:31: in <toplevel>
ERROR: An error occurred during the fetch of repository 'bazel_j2objc':
   Traceback (most recent call last):
    File "/usr/local/google/home/janakr/bazel/tools/build_defs/repo/http.bzl", line 111, column 45, in _http_archive_impl
        download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: thread interrupted
ERROR: /usr/local/google/home/janakr/bazel/WORKSPACE:60:13: fetching http_archive rule //external:bazel_j2objc: Traceback (most recent call last):
    File "/usr/local/google/home/janakr/bazel/tools/build_defs/repo/http.bzl", line 111, column 45, in _http_archive_impl
        download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: thread interrupted
Loading: 0 packages loaded
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.NullPointerException
    at com.google.devtools.build.lib.server.FailureDetails$FailureDetail$Builder.setMessage(FailureDetails.java:6268)
    at com.google.devtools.build.lib.util.InterruptedFailureDetails.detailedExitCode(InterruptedFailureDetails.java:33)
    at com.google.devtools.build.lib.bazel.commands.FetchCommand.exec(FetchCommand.java:154)
    at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:587)
    at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:234)
    at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:548)
    at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:612)
    at io.grpc.Context$1.run(Context.java:579)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

Presumably there should be a message specified in https://github.com/bazelbuild/bazel/blob/8564a01b4f14555334dfd397f8bdb392ee8a53c4/src/main/java/com/google/devtools/build/lib/bazel/commands/FetchCommand.java#L154: InterruptedException often has a null message, so it's not a good candidate.

The error messages are also a bit weird. Why is the INFO message about instantiation printed after the interrupt? The line with "java.lang.IOException" printed is a bit iffy as well. But the crash is obviously the most important bug.

github-actions[bot] commented 1 year ago

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.