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

Error on invalid path characters in .bazelignore #21170

Closed
wants to merge 2 commits into from

Conversation

sushain97
Copy link
Contributor

Fixes #20906.
cc @meteorcloudy

@github-actions github-actions bot added the awaiting-review PR is awaiting review from an assigned reviewer label Feb 1, 2024
fail "Bazel build should have failed"
fi
expect_log "java.nio.file.InvalidPathException: Nul character not allowed"
bazel shutdown
Copy link
Contributor Author

@sushain97 sushain97 Feb 1, 2024

Choose a reason for hiding this comment

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

I'm not super happy about this.

If you remove it, a different test in this file fails which doesn't fail individually:

** test_symlink_cycle_ignored **************************************************
WORKSPACE
-- Test log: -----------------------------------------------------------
$TEST_TMPDIR defined: output root default is '/private/var/tmp/_bazel/57872f73c892b24b35be334f00d21dae/sandbox/darwin-sandbox/4132/execroot/_main/_tmp/205f62347f64a58315b97e6ebfa13f59' and max_idle_secs default is '15'.
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
/etc/bazel.bazelrc
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.NullPointerException: Cannot invoke "com.google.devtools.build.lib.skyframe.IgnoredPackagePrefixesValue.getPatterns()" because "ignoredPackagePrefixesValue" is null
	at com.google.devtools.build.lib.skyframe.SkyframeExecutor.handleDiffs(SkyframeExecutor.java:3181)
	at com.google.devtools.build.lib.skyframe.SequencedSkyframeExecutor.sync(SequencedSkyframeExecutor.java:282)
	at com.google.devtools.build.lib.runtime.CommandEnvironment.syncPackageLoading(CommandEnvironment.java:752)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:582)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:250)
	at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:604)
	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)
	at java.base/java.lang.Thread.run(Unknown Source)

Adding this fixes it which means that my change makes it so that Bazel doesn't crash when it encounters this issue. But, it might crash on the next run unless it's restarted after the .bazelignore is fixed.

Open to thoughts on what might be going wrong here. I would expect Bazel to re-evaluate the IgnoredPackagePrefixesFunction after the .bazelignore changes.

This can be reproduced more easily by trying to "fix" the .bazelignore afterwards:

diff --git a/src/test/shell/bazel/bazelignore_test.sh b/src/test/shell/bazel/bazelignore_test.sh
index 8ef9130268..248950ef39 100755
--- a/src/test/shell/bazel/bazelignore_test.sh
+++ b/src/test/shell/bazel/bazelignore_test.sh
@@ -215,7 +215,9 @@ test_invalid_path() {
       fail "Bazel build should have failed"
     fi
     expect_log "java.nio.file.InvalidPathException: Nul character not allowed"
-    bazel shutdown
+
+    rm .bazelignore
+    bazel build //... || fail "Bazel build should have succeeded"
 }

 run_suite "Integration tests for .bazelignore"

results in

FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.NullPointerException: Cannot invoke "com.google.devtools.build.lib.skyframe.IgnoredPackagePrefixesValue.getPatterns()" because "ignoredPackagePrefixesValue" is null
	at com.google.devtools.build.lib.skyframe.SkyframeExecutor.handleDiffs(SkyframeExecutor.java:3181)
	at com.google.devtools.build.lib.skyframe.SequencedSkyframeExecutor.sync(SequencedSkyframeExecutor.java:282)
	at com.google.devtools.build.lib.runtime.CommandEnvironment.syncPackageLoading(CommandEnvironment.java:752)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:582)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:250)
	at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:604)
	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)
	at java.base/java.lang.Thread.run(Unknown Source)

@sgowroji sgowroji added team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website awaiting-user-response Awaiting a response from the author and removed awaiting-review PR is awaiting review from an assigned reviewer labels Feb 1, 2024
@sushain97
Copy link
Contributor Author

@sgowroji tests are passing now! This is ready for review.

@meteorcloudy meteorcloudy added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-user-response Awaiting a response from the author labels Feb 5, 2024
@copybara-service copybara-service bot closed this in 026f493 Feb 8, 2024
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Feb 8, 2024
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Feb 8, 2024
Fixes bazelbuild#20906.
cc @meteorcloudy

Closes bazelbuild#21170.

PiperOrigin-RevId: 605291552
Change-Id: I8d42729f176b4325ee402c0c6143db9d534c5e0b
@fmeum
Copy link
Collaborator

fmeum commented Feb 8, 2024

@bazel-io fork 7.1.0

bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Feb 8, 2024
Fixes bazelbuild#20906.
cc @meteorcloudy

Closes bazelbuild#21170.

PiperOrigin-RevId: 605291552
Change-Id: I8d42729f176b4325ee402c0c6143db9d534c5e0b
github-merge-queue bot pushed a commit that referenced this pull request Feb 8, 2024
Fixes #20906.
cc @meteorcloudy

Closes #21170.

Commit
026f493

PiperOrigin-RevId: 605291552
Change-Id: I8d42729f176b4325ee402c0c6143db9d534c5e0b

Co-authored-by: Sushain Cherivirala <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bazel crash on windows with java.nio.file.InvalidPathException: Illegal char <*> at index ...
4 participants