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

Using use_extension with something that isn't an extension crashes bazel #22306

Open
ahumesky opened this issue May 9, 2024 · 0 comments
Open
Assignees
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug untriaged

Comments

@ahumesky
Copy link
Contributor

ahumesky commented May 9, 2024

Description of the bug:

I was trying to move a list of things out of the MODULE.bazel file, and created a bzl file with something like artifacts = ["a", "b", "c"], then tried to load that with use_extension(), resulting in the crash below. See bazelbuild/rules_android@52d9d55 for the repro.

FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.IllegalArgumentException: Unsupported type: class com.google.devtools.build.lib.bazel.bzlmod.ModuleFileGlobals$ModuleExtensionProxy
	at com.google.devtools.build.lib.bazel.bzlmod.AttributeValuesAdapter.serializeObject(AttributeValuesAdapter.java:100)
	at com.google.devtools.build.lib.bazel.bzlmod.AttributeValuesAdapter.write(AttributeValuesAdapter.java:53)
	at com.google.devtools.build.lib.bazel.bzlmod.AttributeValuesAdapter.write(AttributeValuesAdapter.java:44)
	at com.google.devtools.build.lib.bazel.bzlmod.Tag_GsonTypeAdapter.write(Tag_GsonTypeAdapter.java:57)
	at com.google.devtools.build.lib.bazel.bzlmod.Tag_GsonTypeAdapter.write(Tag_GsonTypeAdapter.java:12)
	at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
	at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:97)
	at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:61)
	at com.google.devtools.build.lib.bazel.bzlmod.DelegateTypeAdapterFactory$1.write(DelegateTypeAdapterFactory.java:128)
	at com.google.devtools.build.lib.bazel.bzlmod.ModuleExtensionUsage_GsonTypeAdapter.write(ModuleExtensionUsage_GsonTypeAdapter.java:130)
	at com.google.devtools.build.lib.bazel.bzlmod.ModuleExtensionUsage_GsonTypeAdapter.write(ModuleExtensionUsage_GsonTypeAdapter.java:17)
	at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
	at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:97)
	at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:61)
	at com.google.devtools.build.lib.bazel.bzlmod.DelegateTypeAdapterFactory$1.write(DelegateTypeAdapterFactory.java:128)
	at com.google.devtools.build.lib.bazel.bzlmod.Module_GsonTypeAdapter.write(Module_GsonTypeAdapter.java:115)
	at com.google.devtools.build.lib.bazel.bzlmod.Module_GsonTypeAdapter.write(Module_GsonTypeAdapter.java:14)
	at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
	at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:239)
	at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:145)
	at com.google.devtools.build.lib.bazel.bzlmod.DelegateTypeAdapterFactory$1.write(DelegateTypeAdapterFactory.java:128)
	at com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileValue_GsonTypeAdapter.write(BazelLockFileValue_GsonTypeAdapter.java:90)
	at com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileValue_GsonTypeAdapter.write(BazelLockFileValue_GsonTypeAdapter.java:13)
	at com.google.gson.Gson.toJson(Gson.java:747)
	at com.google.gson.Gson.toJson(Gson.java:726)
	at com.google.gson.Gson.toJson(Gson.java:681)
	at com.google.gson.Gson.toJson(Gson.java:661)
	at com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileModule.updateLockfile(BazelLockFileModule.java:239)
	at com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileModule.afterCommand(BazelLockFileModule.java:106)
	at com.google.devtools.build.lib.runtime.BlazeRuntime.afterCommand(BlazeRuntime.java:654)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:704)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:251)
	at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:607)
	at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:676)
	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)

Which category does this issue belong to?

External Dependency

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

bazelbuild/rules_android@52d9d55

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

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 ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

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 team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. labels May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug untriaged
Projects
None yet
Development

No branches or pull requests

5 participants