Skip to content

Conversation

@bazel-io
Copy link
Member

All the values have to be checked for nullness individually.

Fixes the following two NPEs:

  1. refactor: Remove next batch of WORKSPACE content bazel-contrib/rules_go#4531 (comment)
java.lang.NullPointerException: Cannot invoke "com.google.devtools.build.lib.skyframe.PackageValue.getPackage()" because the return value of "com.google.devtools.build.skyframe.SkyframeLookupResult.getOrThrow(com.google.devtools.build.skyframe.SkyKey, java.lang.Class)" is null
	at com.google.devtools.build.lib.skyframe.TestExpansionFunction.getPrerequisites(TestExpansionFunction.java:169)
	at com.google.devtools.build.lib.skyframe.TestExpansionFunction.computeExpandedTests(TestExpansionFunction.java:85)
...
  1. Crash while DirectoryTreeDigestFunction.getSubDirTreeDigests #27942
java.lang.NullPointerException
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
	at com.google.devtools.build.lib.skyframe.DirectoryTreeDigestFunction.getSubDirTreeDigests(DirectoryTreeDigestFunction.java:140)
	at com.google.devtools.build.lib.skyframe.DirectoryTreeDigestFunction.compute(DirectoryTreeDigestFunction.java:65)

Speculative fix for #27942

Closes #27959.

PiperOrigin-RevId: 843808256
Change-Id: I012756ec8a641c68bca31fe155d230caa00d8a3f

Commit 1025821

All the values have to be checked for nullness individually.

Fixes the following two NPEs:
1. bazel-contrib/rules_go#4531 (comment)
```
java.lang.NullPointerException: Cannot invoke "com.google.devtools.build.lib.skyframe.PackageValue.getPackage()" because the return value of "com.google.devtools.build.skyframe.SkyframeLookupResult.getOrThrow(com.google.devtools.build.skyframe.SkyKey, java.lang.Class)" is null
	at com.google.devtools.build.lib.skyframe.TestExpansionFunction.getPrerequisites(TestExpansionFunction.java:169)
	at com.google.devtools.build.lib.skyframe.TestExpansionFunction.computeExpandedTests(TestExpansionFunction.java:85)
...
```
2. bazelbuild#27942
```
java.lang.NullPointerException
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
	at com.google.devtools.build.lib.skyframe.DirectoryTreeDigestFunction.getSubDirTreeDigests(DirectoryTreeDigestFunction.java:140)
	at com.google.devtools.build.lib.skyframe.DirectoryTreeDigestFunction.compute(DirectoryTreeDigestFunction.java:65)
```

Speculative fix for bazelbuild#27942

Closes bazelbuild#27959.

PiperOrigin-RevId: 843808256
Change-Id: I012756ec8a641c68bca31fe155d230caa00d8a3f
@bazel-io bazel-io requested a review from a team as a code owner December 15, 2025 17:39
@bazel-io bazel-io added the awaiting-review PR is awaiting review from an assigned reviewer label Dec 15, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses two NullPointerExceptions by correctly handling null return values from SkyframeLookupResult. The changes in DirectoryTreeDigestFunction.java and TestExpansionFunction.java add necessary null checks, preventing the crashes. The fixes are correct and well-targeted.

@iancha1992 iancha1992 enabled auto-merge (squash) December 15, 2025 21:08
@Wyverald Wyverald disabled auto-merge December 15, 2025 21:18
@Wyverald Wyverald enabled auto-merge December 15, 2025 21:18
@Wyverald Wyverald added this pull request to the merge queue Dec 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 15, 2025
@iancha1992 iancha1992 added this pull request to the merge queue Dec 15, 2025
Merged via the queue into bazelbuild:release-8.5.1 with commit 41816a1 Dec 15, 2025
47 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Dec 15, 2025
rdesgroppes added a commit to DataDog/datadog-agent that referenced this pull request Jan 13, 2026
This upgrade brings several performance improvements and bug fixes:

#### Performance improvements
- remote execution: bazelbuild/bazel#27564
- module extensions: bazelbuild/bazel#27296

#### Reliability improvements
- cache invalidation: bazelbuild/bazel#27417
- configuration: bazelbuild/bazel#27128
- Git repositories: bazelbuild/bazel#27705
- query:
  - bazelbuild/bazel#27560
  - bazelbuild/bazel#27117
- registry mirrors: bazelbuild/bazel#27531

#### Bug fixes
- remote cache: bazelbuild/bazel#27996
- repository handling: bazelbuild/bazel#27995
- repository cache: bazelbuild/bazel#28161
- local execution: bazelbuild/bazel#27994
rdesgroppes added a commit to DataDog/datadog-agent that referenced this pull request Jan 13, 2026
This upgrade brings several performance improvements and bug fixes:

## Performance improvements (8.5.0)
- Remote execution: Add --remote_max_concurrency_per_connection flag to control concurrent gRPC requests (default: 100)
  bazelbuild/bazel#27564
- Module extensions: Support storing/retrieving JSON-like Starlark objects without invalidation, reducing unnecessary rebuilds
  bazelbuild/bazel#27296

## Reliability improvements (8.5.0)
- Cache invalidation: Source directory contents now tracked for proper invalidation
  bazelbuild/bazel#27417
- Configuration: Add ctx.configuration.short_id for identifying configurations
  bazelbuild/bazel#27128
- Git repositories: git_repository now checks out default branch when unspecified
  bazelbuild/bazel#27705
- Query: Add executables() function and fix genquery for external repos
  bazelbuild/bazel#27560
  bazelbuild/bazel#27117
- Registry mirrors: --module_mirrors now supports per-registry mirror specification
  bazelbuild/bazel#27531

## Bug fixes (8.5.1)
- Remote cache: Add option to continue with local execution if remote cache is unavailable
  bazelbuild/bazel#27996
- Repository handling: Fix crash when mixing use_repo_rule and --inject_repository
  bazelbuild/bazel#27995
- Repository cache: Fix permission denied issue with --experimental_repository_cache_hardlinks
  bazelbuild/bazel#28161
- Local execution: Fix incorrect SkyframeLookupResult usage
  bazelbuild/bazel#27994

Both 8.5.0 and 8.5.1 are fully backward compatible with Bazel 8.0.

## Dependency updates
- Upgrade rules_go from 0.57.0 to 0.59.0 for Bazel 8.5+ compatibility
  bazel-contrib/rules_go#4493
- Configure sh_configure extension for rules_shell to auto-detect shell toolchain

## Platform-specific changes
- Windows: Configure hermetic shell via --repo_env=BAZEL_SH which is used by both
  sh_configure (sh_binary/sh_test) and --shell_executable (genrule/run_shell).
  This eliminates dependency on system environment variables.
- Windows: Disable code coverage collection (--nocollect_code_coverage) to avoid
  shell toolchain issues. Coverage requires sh_binary (collect_coverage) which
  needs a hermetic shell toolchain not yet available.
  bazelbuild/rules_shell#4

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
rdesgroppes added a commit to DataDog/datadog-agent that referenced this pull request Jan 13, 2026
This upgrade brings several performance improvements and bug fixes:

#### Performance improvements
- remote execution: bazelbuild/bazel#27564
- module extensions: bazelbuild/bazel#27296

#### Reliability improvements
- cache invalidation: bazelbuild/bazel#27417
- configuration: bazelbuild/bazel#27128
- Git repositories: bazelbuild/bazel#27705
- query:
  - bazelbuild/bazel#27560
  - bazelbuild/bazel#27117
- registry mirrors: bazelbuild/bazel#27531

#### Bug fixes
- remote cache: bazelbuild/bazel#27996
- repository handling: bazelbuild/bazel#27995
- repository cache: bazelbuild/bazel#28161
- local execution: bazelbuild/bazel#27994
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.

4 participants