Use comparator when extracting relevant facts for lockfile#27816
Closed
malt3 wants to merge 2 commits intobazelbuild:masterfrom
Closed
Use comparator when extracting relevant facts for lockfile#27816malt3 wants to merge 2 commits intobazelbuild:masterfrom
malt3 wants to merge 2 commits intobazelbuild:masterfrom
Conversation
ModuleExtensionId is not comparable by itself and needs a comparator.
Before this fix, I was able to crash Bazel with this message:
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.ClassCastException: class com.google.devtools.build.lib.bazel.bzlmod.ModuleExtensionId cannot be cast to class java.lang.Comparable (com.google.devtools.build.lib.bazel.bzlmod.ModuleExtensionId is in unnamed module of loader 'app'; java.lang.Comparable is in module java.base of loader 'bootstrap')
at com.google.common.collect.NaturalOrdering.compare(NaturalOrdering.java:29)
at com.google.common.collect.ImmutableSortedMap.lambda$fromEntries$0(ImmutableSortedMap.java:536)
at java.base/java.util.TimSort.countRunAndMakeAscending(Unknown Source)
at java.base/java.util.TimSort.sort(Unknown Source)
at java.base/java.util.Arrays.sort(Unknown Source)
at com.google.common.collect.ImmutableSortedMap.fromEntries(ImmutableSortedMap.java:528)
at com.google.common.collect.ImmutableSortedMap.fromEntries(ImmutableSortedMap.java:495)
at com.google.common.collect.ImmutableSortedMap.copyOfInternal(ImmutableSortedMap.java:474)
at com.google.common.collect.ImmutableSortedMap.copyOf(ImmutableSortedMap.java:372)
at com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileModule.afterCommand(BazelLockFileModule.java:135)
at com.google.devtools.build.lib.runtime.BlazeRuntime.afterCommand(BlazeRuntime.java:734)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:711)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:257)
at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:607)
at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$0(GrpcServerImpl.java:677)
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)
fmeum
approved these changes
Nov 27, 2025
Collaborator
|
@bazel-io fork 8.5.0 |
Collaborator
|
@bazel-io fork 9.0.0 |
This was referenced Nov 27, 2025
Collaborator
|
@Wyverald An alternative would be to make ModuleExtensionId comparable, what do you think of that? |
meteorcloudy
approved these changes
Dec 3, 2025
Member
meteorcloudy
left a comment
There was a problem hiding this comment.
Let's merge this one to unblock 8.5 first
SalmaSamy
approved these changes
Dec 4, 2025
bazel-io
pushed a commit
to bazel-io/bazel
that referenced
this pull request
Dec 5, 2025
ModuleExtensionId is not comparable by itself and needs a comparator. Before this fix, I was able to crash Bazel with this message:
```
FATAL: bazel crashed due to an internal error. Printing stack trace: java.lang.ClassCastException: class com.google.devtools.build.lib.bazel.bzlmod.ModuleExtensionId cannot be cast to class java.lang.Comparable (com.google.devtools.build.lib.bazel.bzlmod.ModuleExtensionId is in unnamed module of loader 'app'; java.lang.Comparable is in module java.base of loader 'bootstrap')
at com.google.common.collect.NaturalOrdering.compare(NaturalOrdering.java:29)
at com.google.common.collect.ImmutableSortedMap.lambda$fromEntries$0(ImmutableSortedMap.java:536)
at java.base/java.util.TimSort.countRunAndMakeAscending(Unknown Source)
at java.base/java.util.TimSort.sort(Unknown Source)
at java.base/java.util.Arrays.sort(Unknown Source)
at com.google.common.collect.ImmutableSortedMap.fromEntries(ImmutableSortedMap.java:528)
at com.google.common.collect.ImmutableSortedMap.fromEntries(ImmutableSortedMap.java:495)
at com.google.common.collect.ImmutableSortedMap.copyOfInternal(ImmutableSortedMap.java:474)
at com.google.common.collect.ImmutableSortedMap.copyOf(ImmutableSortedMap.java:372)
at com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileModule.afterCommand(BazelLockFileModule.java:135)
at com.google.devtools.build.lib.runtime.BlazeRuntime.afterCommand(BlazeRuntime.java:734)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:711)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:257)
at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:607)
at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$0(GrpcServerImpl.java:677)
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)
```
Fixes bazelbuild#27522
Closes bazelbuild#27816.
PiperOrigin-RevId: 840671327
Change-Id: Ia7eb05be4fd099f0e2711065faf4c344d45265b5
bazel-io
pushed a commit
to bazel-io/bazel
that referenced
this pull request
Dec 5, 2025
ModuleExtensionId is not comparable by itself and needs a comparator. Before this fix, I was able to crash Bazel with this message:
```
FATAL: bazel crashed due to an internal error. Printing stack trace: java.lang.ClassCastException: class com.google.devtools.build.lib.bazel.bzlmod.ModuleExtensionId cannot be cast to class java.lang.Comparable (com.google.devtools.build.lib.bazel.bzlmod.ModuleExtensionId is in unnamed module of loader 'app'; java.lang.Comparable is in module java.base of loader 'bootstrap')
at com.google.common.collect.NaturalOrdering.compare(NaturalOrdering.java:29)
at com.google.common.collect.ImmutableSortedMap.lambda$fromEntries$0(ImmutableSortedMap.java:536)
at java.base/java.util.TimSort.countRunAndMakeAscending(Unknown Source)
at java.base/java.util.TimSort.sort(Unknown Source)
at java.base/java.util.Arrays.sort(Unknown Source)
at com.google.common.collect.ImmutableSortedMap.fromEntries(ImmutableSortedMap.java:528)
at com.google.common.collect.ImmutableSortedMap.fromEntries(ImmutableSortedMap.java:495)
at com.google.common.collect.ImmutableSortedMap.copyOfInternal(ImmutableSortedMap.java:474)
at com.google.common.collect.ImmutableSortedMap.copyOf(ImmutableSortedMap.java:372)
at com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileModule.afterCommand(BazelLockFileModule.java:135)
at com.google.devtools.build.lib.runtime.BlazeRuntime.afterCommand(BlazeRuntime.java:734)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:711)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:257)
at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:607)
at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$0(GrpcServerImpl.java:677)
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)
```
Fixes bazelbuild#27522
Closes bazelbuild#27816.
PiperOrigin-RevId: 840671327
Change-Id: Ia7eb05be4fd099f0e2711065faf4c344d45265b5
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 5, 2025
…27881) ModuleExtensionId is not comparable by itself and needs a comparator. Before this fix, I was able to crash Bazel with this message: ``` FATAL: bazel crashed due to an internal error. Printing stack trace: java.lang.ClassCastException: class com.google.devtools.build.lib.bazel.bzlmod.ModuleExtensionId cannot be cast to class java.lang.Comparable (com.google.devtools.build.lib.bazel.bzlmod.ModuleExtensionId is in unnamed module of loader 'app'; java.lang.Comparable is in module java.base of loader 'bootstrap') at com.google.common.collect.NaturalOrdering.compare(NaturalOrdering.java:29) at com.google.common.collect.ImmutableSortedMap.lambda$fromEntries$0(ImmutableSortedMap.java:536) at java.base/java.util.TimSort.countRunAndMakeAscending(Unknown Source) at java.base/java.util.TimSort.sort(Unknown Source) at java.base/java.util.Arrays.sort(Unknown Source) at com.google.common.collect.ImmutableSortedMap.fromEntries(ImmutableSortedMap.java:528) at com.google.common.collect.ImmutableSortedMap.fromEntries(ImmutableSortedMap.java:495) at com.google.common.collect.ImmutableSortedMap.copyOfInternal(ImmutableSortedMap.java:474) at com.google.common.collect.ImmutableSortedMap.copyOf(ImmutableSortedMap.java:372) at com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileModule.afterCommand(BazelLockFileModule.java:135) at com.google.devtools.build.lib.runtime.BlazeRuntime.afterCommand(BlazeRuntime.java:734) at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:711) at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:257) at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:607) at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$0(GrpcServerImpl.java:677) 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) ``` Fixes #27522 Closes #27816. PiperOrigin-RevId: 840671327 Change-Id: Ia7eb05be4fd099f0e2711065faf4c344d45265b5 Commit b2587f6 Co-authored-by: Malte Poll <1780588+malt3@users.noreply.github.com>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 5, 2025
…27882) ModuleExtensionId is not comparable by itself and needs a comparator. Before this fix, I was able to crash Bazel with this message: ``` FATAL: bazel crashed due to an internal error. Printing stack trace: java.lang.ClassCastException: class com.google.devtools.build.lib.bazel.bzlmod.ModuleExtensionId cannot be cast to class java.lang.Comparable (com.google.devtools.build.lib.bazel.bzlmod.ModuleExtensionId is in unnamed module of loader 'app'; java.lang.Comparable is in module java.base of loader 'bootstrap') at com.google.common.collect.NaturalOrdering.compare(NaturalOrdering.java:29) at com.google.common.collect.ImmutableSortedMap.lambda$fromEntries$0(ImmutableSortedMap.java:536) at java.base/java.util.TimSort.countRunAndMakeAscending(Unknown Source) at java.base/java.util.TimSort.sort(Unknown Source) at java.base/java.util.Arrays.sort(Unknown Source) at com.google.common.collect.ImmutableSortedMap.fromEntries(ImmutableSortedMap.java:528) at com.google.common.collect.ImmutableSortedMap.fromEntries(ImmutableSortedMap.java:495) at com.google.common.collect.ImmutableSortedMap.copyOfInternal(ImmutableSortedMap.java:474) at com.google.common.collect.ImmutableSortedMap.copyOf(ImmutableSortedMap.java:372) at com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileModule.afterCommand(BazelLockFileModule.java:135) at com.google.devtools.build.lib.runtime.BlazeRuntime.afterCommand(BlazeRuntime.java:734) at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:711) at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:257) at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:607) at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$0(GrpcServerImpl.java:677) 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) ``` Fixes #27522 Closes #27816. PiperOrigin-RevId: 840671327 Change-Id: Ia7eb05be4fd099f0e2711065faf4c344d45265b5 Commit b2587f6 Co-authored-by: Malte Poll <1780588+malt3@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ModuleExtensionId is not comparable by itself and needs a comparator. Before this fix, I was able to crash Bazel with this message:
Fixes #27522