Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to execute bazel info without a module file #24239

Closed
shs96c opened this issue Nov 7, 2024 · 9 comments
Closed

Unable to execute bazel info without a module file #24239

shs96c opened this issue Nov 7, 2024 · 9 comments
Labels
team-Core Skyframe, bazel query, BEP, options parsing, bazelrc type: bug untriaged

Comments

@shs96c
Copy link
Contributor

shs96c commented Nov 7, 2024

Description of the bug:

See the build logs from this PR in rules_jvm_external

The execution of bazel info fails with:

FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.NullPointerException: Cannot invoke "java.lang.Throwable.getMessage()" because "cause" is null
	at com.google.devtools.build.lib.analysis.config.InvalidConfigurationException.<init>(InvalidConfigurationException.java:53)
	at com.google.devtools.build.lib.skyframe.SkyframeExecutor.createBuildConfigurationKey(SkyframeExecutor.java:1813)
	at com.google.devtools.build.lib.skyframe.SkyframeExecutor.getConfiguration(SkyframeExecutor.java:1752)
	at com.google.devtools.build.lib.runtime.commands.InfoCommand.lambda$exec$0(InfoCommand.java:158)
	at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:181)
	at com.google.devtools.build.lib.runtime.commands.InfoCommand.exec(InfoCommand.java:215)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:664)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:244)
	at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:573)
	at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:641)
	at io.grpc.Context$1.run(Context.java:566)
	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)
Traceback (most recent call last):
  File "bazelci.py", line 4493, in <module>
    sys.exit(main())
  File "bazelci.py", line 4471, in main
    bazel_version=task_config.get("bazel") or configs.get("bazel"),
  File "bazelci.py", line 1212, in execute_commands
    bazel_version = print_bazel_version_info(bazel_binary, platform)
  File "bazelci.py", line 1515, in print_bazel_version_info
    [bazel_binary] + common_startup_flags() + ["--nosystem_rc", "--nohome_rc", "info"]
  File "bazelci.py", line 2653, in execute_command
    subprocess.PIPE if capture_stderr else None
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['bazel', '--nosystem_rc', '--nohome_rc', 'info']' returned non-zero exit status 37.

Which category does this issue belong to?

Core

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

  1. Clone rules_jvm_external and checks out d8cc6c07f2c1c61276f46e6f03b270db497e98fe.
  2. cd examples/simple
  3. bazel info

Which operating system are you running Bazel on?

macOS and Linux

What is the output of bazel info release?

7.4.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

https://github.com/bazel-contrib/rules_jvm_external.git
d8cc6c07f2c1c61276f46e6f03b270db497e98fe

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@github-actions github-actions bot added the team-Core Skyframe, bazel query, BEP, options parsing, bazelrc label Nov 7, 2024
shs96c added a commit to shs96c/bazel that referenced this issue Nov 7, 2024
shs96c added a commit to shs96c/bazel that referenced this issue Nov 7, 2024
@shs96c
Copy link
Contributor Author

shs96c commented Nov 7, 2024

Digging a little deeper, the error was caused by skylib being referenced before skylib had been loaded in a workspace-based build.

@shs96c
Copy link
Contributor Author

shs96c commented Nov 7, 2024

The precise error being:

ERROR: ErrorInfo{exception=null, cycles=[[] -> [[/Volumes/Dev/src/github.com/bazel-contrib/rules_jvm_external/examples/simple]/[WORKSPACE], 2, KeyForWorkspace{label=@@rules_jvm_external//:repositories.bzl, isBuildPrelude=false}, KeyForWorkspace{label=@@rules_jvm_external//private/rules:maven_install.bzl, isBuildPrelude=false}, KeyForWorkspace{label=@@rules_jvm_external//private/rules:coursier.bzl, isBuildPrelude=false}, KeyForWorkspace{label=@@rules_jvm_external//private:dependency_tree_parser.bzl, isBuildPrelude=false}, KeyForWorkspace{label=@@rules_jvm_external//private:coursier_utilities.bzl, isBuildPrelude=false}, KeyForWorkspace{label=@@rules_jvm_external//:specs.bzl, isBuildPrelude=false}, KeyForWorkspace{label=@@bazel_skylib//lib:structs.bzl, isBuildPrelude=false}, CONTAINING_PACKAGE_LOOKUP:@@bazel_skylib//lib, PACKAGE_LOOKUP:@@bazel_skylib//lib, REPOSITORY_DIRECTORY:@@bazel_skylib]], isCatastrophic=false, isDirectlyTransient=false, isTransitivelyTransient=false}

@katre
Copy link
Member

katre commented Nov 7, 2024

Yes, looks like a few places are creating an InvalidConfigurationException without checking for cycles, assuming there is a valid exception.

I'll add some checks for that.

@katre
Copy link
Member

katre commented Nov 7, 2024

I think I have a better fix but I can't reproduce the issue, I'll put up a draft PR in a few minutes, would you be able to test it?

@shs96c
Copy link
Contributor Author

shs96c commented Nov 7, 2024

Sure. I'd be happy to

katre added a commit to katre/bazel that referenced this issue Nov 7, 2024
…ations.

Part of bazelbuild#24239.

PiperOrigin-RevId: 694147129
Change-Id: I7d0a9c129c34725d0843eb7ec87b46c657d168d8
@katre
Copy link
Member

katre commented Nov 7, 2024

Take a look at #24241

@shs96c
Copy link
Contributor Author

shs96c commented Nov 7, 2024

Works on my machine :) Thank you for the more complete fix!

@katre
Copy link
Member

katre commented Nov 7, 2024

okay, I'll split it out and merge mine, and drop #24240.

katre added a commit to katre/bazel that referenced this issue Nov 7, 2024
…ations.

Fixes bazelbuild#24239.

Closes bazelbuild#24241.

PiperOrigin-RevId: 694147129
Change-Id: I7d0a9c129c34725d0843eb7ec87b46c657d168d8
@katre
Copy link
Member

katre commented Nov 7, 2024

Okay, fix is submitted at head, @shs96c can you handle the cherrypick requests for 7.4.x and 8.0.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Core Skyframe, bazel query, BEP, options parsing, bazelrc type: bug untriaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants