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

Bazel+RBE failure on Windows with target of length 89 or 90 #12310

Closed
veblush opened this issue Oct 19, 2020 · 13 comments
Closed

Bazel+RBE failure on Windows with target of length 89 or 90 #12310

veblush opened this issue Oct 19, 2020 · 13 comments
Assignees
Labels
area-Windows Windows-specific issues and feature requests P1 I'll work on this now. (Assignee required) team-Remote-Exec Issues and PRs for the Execution (Remote) team type: bug

Comments

@veblush
Copy link

veblush commented Oct 19, 2020

Description of the problem:

I ran into a weird error when running a test through Bazel RBE on Windows. There is the issue describing it in detail. Its summary is that SymInitialize (Windows Debug API) fails only when the length of the target is 89 or 90. When the target name is shortened or lengthened, this issue is fixed. So something related to the length should be there.

This is a PR to reproduce this simply and I haven't seen this problem when running Bazel directly on Windows. The Bazel RBE team investigated this problem and this might be a result of combination of bazel and docker so I like to get help from the Bazel team.

I guess changing the threshold (from 260 to 258) to use shortened paths on Windows can fix this issue. code

Internal bug with details: b/169902891

Feature requests: what underlying problem are you trying to solve with this feature?

SymInitialize failed only when the length of path is 89 and 90

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

grpc/grpc#24302

What operating system are you running Bazel on?

Windows server 2016

What's the output of bazel info release?

I cannot run bazel info but the version of bazel is 2.2.0.

@aiuto aiuto added area-Windows Windows-specific issues and feature requests team-Remote-Exec Issues and PRs for the Execution (Remote) team untriaged labels Oct 20, 2020
@philwo philwo added P1 I'll work on this now. (Assignee required) type: bug and removed untriaged labels Nov 26, 2020
@jin
Copy link
Member

jin commented Jan 19, 2021

Is this still a P1 bug?

@veblush
Copy link
Author

veblush commented Jan 21, 2021

@jin Yep, this is still affecting gRPC debugging.

@meteorcloudy
Copy link
Member

@veblush Can you help verify if #12941 fixes this problem? You can cherry-pick this change and build a custom Bazel binary based the Bazel version you were using. Let me know if I can help verify this!

@veblush
Copy link
Author

veblush commented Feb 11, 2021

@meteorcloudy Thank for the fix! I don't know how to use a custom build Bazel, though. Have you tried to build my reproduction case described here?

@meteorcloudy
Copy link
Member

@veblush

I couldn't reproduce because I don't have access to required RBE resources.

I prepared a branch with the fix based on Bazel 2.2.0:
https://github.com/bazelbuild/bazel/tree/gh-12310-fix-on-2.2.0

Can you fetch this branch and built a custom Bazel binary via bazel build //src:bazel?

@veblush
Copy link
Author

veblush commented Mar 2, 2021

@meteorcloudy

Thanks for the fix and I tried to build it on kokoro winserver2016 but failed.

$ bazel --version
bazel 3.7.1

$ git status
On branch gh-12310-fix-on-2.2.0
Your branch is up to date with 'origin/gh-12310-fix-on-2.2.0'.

$ java -version
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

$ bazel build //src:bazel-dev

ERROR: C:/cygwin64/home/kbuilder/bazel/src/main/java/com/google/devtools/build/lib/concurrent/BUILD:12:13: Building src/main/java/com/google/devtools/build/lib/concurrent/libconcurrent.jar (22 source files) failed (Exit 1): java.exe failed: error executing command external/remotejdk11_win/bin/java.exe -XX:+UseParallelOldGC -XX:-CompactStrings --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED ... (remaining 15 argument(s) skipped)
src\main\java\com\google\devtools\build\lib\concurrent\MultisetSemaphore.java:89: error: [PreconditionsInvalidPlaceholder] Preconditions only accepts the %s placeholder in error message strings
          "maxNumUniqueValues must be positive (was %d)",
          ^
    (see https://errorprone.info/bugpattern/PreconditionsInvalidPlaceholder)
  Did you mean '"maxNumUniqueValues must be positive (was %s)",'?
Target //src:bazel-dev failed to build

@mai93
Copy link
Contributor

mai93 commented Mar 2, 2021

Can you try building it with Bazel 2.1.0? I managed to build this branch using this version.

@meteorcloudy
Copy link
Member

@veblush Yeah, like Mai said, can you try to build Bazel 2.2.0 with Bazel 2.1.0, the latest version of Bazel is sometimes unable to build old version of Bazel due to some breaking changes.

@veblush
Copy link
Author

veblush commented Mar 10, 2021

Sorry for the late response. I tried it with bazel 2.1.0 but it wasn't able to build it.

$ choco install bazel --version=2.1.0 --force
$ bazel --version
bazel 2.1.0
$ bazel clean --expunge
$ bazel build //src:bazel-dev 
...
ERROR: C:/cygwin64/home/kbuilder/bazel/src/BUILD:321:2: Executing genrule //src:package-zip_jdk_allmodules failed (Exit 2)
bazel-out/host/bin/src/package-bazel-on-host-platform.sh: line 16: $'\r': command not found
: invalid option namec/package-bazel-on-host-platform.sh: line 17: set: pipefail
Target //src:bazel-dev failed to build

@veblush
Copy link
Author

veblush commented Mar 10, 2021

You can reproduce this without using bazel_rbe which requires a right credential. Can you try it on windows?

> git clone https://github.com/grpc/grpc.git
> cd grpc
> git fetch origin pull/24302/head:stacktrace-long
> git checkout stacktrace-long
> bazel test //test/core/extra:all

@meteorcloudy
Copy link
Member

bazel-out/host/bin/src/package-bazel-on-host-platform.sh: line 16: $'\r': command not found\

Hmm, looks like your files may have the Windows line ending CRLF (\n\r), you can tell git to always use LF by git config --global core.eol lf or just turn off the auto converting git config --global core.autocrlf false

@mai93 Do I understand correctly that you actually verified the fix worked in the RBE build, right?

@mai93
Copy link
Contributor

mai93 commented Mar 11, 2021

Yes, all tests passed with the fix but I was working with Bazel 3.7.2. With Bazel 2.2.0 + the fix, I get the following error:

ERROR: C:/users/lenovo/_bazel_lenovo/hhw2zfl5/external/upb/bazel/upb_proto_library.bzl:257:29: aspect() got unexpected keyword argument 'incompatible_use_toolchain_transition'
ERROR: while parsing '//test/core/extra:all': error loading package 'test/core/extra': in D:/bazel/bug-12310/ooo/grpc/bazel/grpc_build_system.bzl: Extension file 'bazel/upb_proto_library.bzl' has errors

@meteorcloudy
Copy link
Member

Nice. The error with 2.2.0 should be caused by something else. I think we can merge your fix now.

katre pushed a commit that referenced this issue Jul 12, 2021
This PR applies the suggested fix for #12310. Although I could not reproduce it.

Fixes: #12310

Closes #12941.

PiperOrigin-RevId: 362327025
katre pushed a commit to katre/bazel that referenced this issue Jul 13, 2021
This PR applies the suggested fix for bazelbuild#12310. Although I could not reproduce it.

Fixes: bazelbuild#12310

Closes bazelbuild#12941.

PiperOrigin-RevId: 362327025
katre pushed a commit to katre/bazel that referenced this issue Jul 13, 2021
This PR applies the suggested fix for bazelbuild#12310. Although I could not reproduce it.

Fixes: bazelbuild#12310

Closes bazelbuild#12941.

PiperOrigin-RevId: 362327025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests P1 I'll work on this now. (Assignee required) team-Remote-Exec Issues and PRs for the Execution (Remote) team type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants