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

Permission denied on Windows tests (flaky) #1012

Open
laurentlb opened this issue Jul 30, 2020 · 10 comments · Fixed by #1017
Open

Permission denied on Windows tests (flaky) #1012

laurentlb opened this issue Jul 30, 2020 · 10 comments · Fixed by #1017
Assignees

Comments

@laurentlb
Copy link
Contributor

I see lots of Windows failures on this pipeline: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/579
For example, I see 7 failures for the flag incompatible_string_replace_count, all of them seem flaky.

Examples of error messages:

(03:05:57) ERROR: C:/b/bk-windows-drwz/bazel-downstream-projects/buildtools/buildifier2/BUILD.bazel:3:11: no such package '@skylark_syntax//syntax': no such package '@bazel_gazelle_go_repository_cache//': C:/b/pmtr6clt/external/bazel_gazelle_go_repository_cache/pkg/mod/github.com/chzyer/readline@v0.0.0-20180603132655-2972be24d48e/doc (Permission denied) and referenced by '//buildifier2:go_default_library'

(03:13:11) ERROR: C:/b/hhtk5fpz/external/bazel_tools/tools/jdk/BUILD:383:6: @bazel_tools//tools/jdk:remote_toolchain depends on @remote_java_tools_windows//:toolchain in repository @remote_java_tools_windows which failed to fetch. no such package '@remote_java_tools_windows//': C:/b/hhtk5fpz/external/remote_java_tools_windows/java_tools/JavaBuilder_deploy.jar (Permission denied)

(03:05:33) ERROR: C:/b/bk-windows-601l/bazel-downstream-projects/bazelisk/BUILD:41:11: no such package '@com_github_mitchellh_go_homedir//': no such package '@bazel_gazelle_go_repository_cache//': C:/b/5t7h6vom/external/bazel_gazelle_go_repository_cache/pkg/mod/github.com/hashicorp/go-version@v1.2.0 (Permission denied) and referenced by '//:go_default_library'

@laurentlb laurentlb changed the title Flaky Windows tests Permission denied on Windows tests (flaky) Jul 30, 2020
@meteorcloudy
Copy link
Member

I can reproduce this issue locally, will look into it soon!

@meteorcloudy
Copy link
Member

meteorcloudy commented Aug 6, 2020

It looks like we are hitting something similar to bazelbuild/bazel#7458

I haven't figured out exactly why, but enabling symlink support via --windows_enable_symlink seems to fix the problem.

@meteorcloudy
Copy link
Member

OK, the reason of this failure is because the Java worker will hold the file handle of C:\src\tmp\cbtx3svz\external\remote_java_tools_windows\java_tools\JavaBuilder_deploy.jar.
When we change an incompatible flag that will cause Bazel to refetch the java tool (eg. --incompatible_disable_depset_items), Bazel will fail the clean up the directory of C:\src\tmp\cbtx3svz\external\remote_java_tools_windows, because JavaBuilder_deploy.jar is still open.

To workaround this issue on CI, we can use Bazelisk's BAZELISK_SHUTDOWN feature, which will shut down bazel between builds and ensure the file handles are released by the Java workers.

@laurentlb
Copy link
Contributor Author

It still fails: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/592#83a2bd3b-a04d-4dea-8aa1-3812ec39c251

(03:03:01) ERROR: C:/b/bk-windows-drwz/bazel-downstream-projects/bazel-skylib/gazelle/BUILD:6:11: no such package '@com_github_bazelbuild_buildtools//build': no such package '@bazel_gazelle_go_repository_cache//': C:/b/zbugc6cn/external/bazel_gazelle_go_repository_cache/pkg/mod/github.com/!burnt!sushi/toml@v0.3.1/cmd/toml-test-decoder (Permission denied) and referenced by '//gazelle:go_default_library'

@laurentlb
Copy link
Contributor Author

Can we reopen this bug? Or I can file a new one.

@meteorcloudy
Copy link
Member

Oh sorry, we can re-open this. Looks like my change only fixed the Bazel Federation case, but not for this one.

@meteorcloudy meteorcloudy reopened this Aug 18, 2020
meteorcloudy added a commit to meteorcloudy/bazel that referenced this issue Aug 20, 2020
If some directory is set to read-only on Windows, DeletePath will fail
to delete that directory even when no one else is using it.

Previously, we only remote read-only attribute for files before
deleting, we should also do the same for deleting directory.

Fixes bazelbuild/continuous-integration#1012
@meteorcloudy
Copy link
Member

The bug is on Bazel side. Can you please help review the fix bazelbuild/bazel#11982?

@meteorcloudy
Copy link
Member

Let's keep this open until we are sure the problem is fixed. We'll have to wait for the next month's Bazel release.

@tetromino
Copy link
Contributor

FYI, I'm hitting this in Stardoc today with Bazel 6.3.2 as well as 7.0 pre: bazelbuild/stardoc#179 -> https://buildkite.com/bazel/stardoc/builds/1081

tetromino added a commit to bazelbuild/stardoc that referenced this issue Aug 8, 2023
…t_transitions (#179)

And to make sure we stay unbroken, add the flag to our ci config - which on Windows requires setting `BAZELISK_SHUTDOWN=1` to work around bazelbuild/continuous-integration#1012

Fixes #145
tetromino added a commit to bazelbuild/stardoc that referenced this issue Aug 11, 2023
@rickeylev
Copy link
Contributor

FYI: I've been seeing this lately. Mostly with rules_python, but I also so it in a BCR PR today.

Not a lot, maybe like once or twice a week / 50-100 CI runs. Few enough that pressing retry isn't a big inconvenience, but often enough that retry doesn't always fix it, and enough to mention it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants