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

Tolerate bad query result with bzlmod support #213

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

tgeng
Copy link
Contributor

@tgeng tgeng commented Apr 15, 2024

We are seeing the following errors with my previous change 😅 . Apparently bazel query can sometimes fail and as a result bazel-diff crashes due to NPE in such cases. Unfortunately I can't figured out another way to reliably get the path under <bazel-cache/external/ without bazel query so this PR will just fallback to the old bazel external module path if bazel query failed.

09:01:24 GMT-07:00  com.google.common.util.concurrent.UncheckedExecutionException: java.lang.NullPointerException: readLine(...) must not be null
09:01:24 GMT-07:00  	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2055)
09:01:24 GMT-07:00  	at com.google.common.cache.LocalCache.get(LocalCache.java:3966)
09:01:24 GMT-07:00  	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3989)
09:01:24 GMT-07:00  	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4950)
09:01:24 GMT-07:00  	at com.bazel_diff.hash.ExternalRepoResolver.resolveExternalRepoRoot(ExternalRepoResolver.kt:28)
09:01:24 GMT-07:00  	at com.bazel_diff.hash.SourceFileHasher$digest$1.invoke(SourceFileHasher.kt:58)
09:01:24 GMT-07:00  	at com.bazel_diff.hash.SourceFileHasher$digest$1.invoke(SourceFileHasher.kt:42)
09:01:24 GMT-07:00  	at com.bazel_diff.hash.HashingExtensionsKt.sha256(HashingExtensions.kt:14)
09:01:24 GMT-07:00  	at com.bazel_diff.hash.SourceFileHasher.digest(SourceFileHasher.kt:42)
09:01:24 GMT-07:00  	at com.bazel_diff.hash.BuildGraphHasher$hashSourcefiles$result$1.apply(BuildGraphHasher.kt:71)
09:01:24 GMT-07:00  	at com.bazel_diff.hash.BuildGraphHasher$hashSourcefiles$result$1.apply(BuildGraphHasher.kt:62)
09:01:24 GMT-07:00  	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
09:01:24 GMT-07:00  	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
09:01:24 GMT-07:00  	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
09:01:24 GMT-07:00  	at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
09:01:24 GMT-07:00  	at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754)
09:01:24 GMT-07:00  	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
09:01:24 GMT-07:00  	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
09:01:24 GMT-07:00  	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
09:01:24 GMT-07:00  	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
09:01:24 GMT-07:00  	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
09:01:24 GMT-07:00  Caused by: java.lang.NullPointerException: readLine(...) must not be null
09:01:24 GMT-07:00  	at com.bazel_diff.hash.ExternalRepoResolver.runProcessAndCaptureFirstLine(ExternalRepoResolver.kt:44)
09:01:24 GMT-07:00  	at com.bazel_diff.hash.ExternalRepoResolver.resolveBzlModPath(ExternalRepoResolver.kt:33)
09:01:24 GMT-07:00  	at com.bazel_diff.hash.ExternalRepoResolver.access$resolveBzlModPath(ExternalRepoResolver.kt:10)
09:01:24 GMT-07:00  	at com.bazel_diff.hash.ExternalRepoResolver$cache$1.apply(ExternalRepoResolver.kt:24)
09:01:24 GMT-07:00  	at com.bazel_diff.hash.ExternalRepoResolver$cache$1.apply(ExternalRepoResolver.kt:19)
09:01:24 GMT-07:00  	at com.google.common.cache.CacheLoader$FunctionToCacheLoader.load(CacheLoader.java:169)
09:01:24 GMT-07:00  	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3533)
09:01:24 GMT-07:00  	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2282)
09:01:24 GMT-07:00  	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2159)
09:01:24 GMT-07:00  	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2049)
09:01:24 GMT-07:00  	... 20 more

Copy link
Collaborator

@tinder-maxwellelliott tinder-maxwellelliott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@tinder-maxwellelliott tinder-maxwellelliott merged commit f1df601 into Tinder:master Apr 15, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants