-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Defining C++ repos with module 'use_repo_rule' impacts windows (msvc/clang-cl) compile speed by up to 5x - tildes? #22865
Comments
Could you share a Starlark profile of the builds? If you are worried about leaking target names, sharing a redacted screenshot of each would already be very helpful. |
I was wondering if it is due to the tildes ~ which are a special character in windows 8.3. filenames. I've disabled 8.3 filenames using fsutil 8dot3name set 3 but we have no way of knowing if any special code still executes in the windows kernel when it comes across a request for a file containing ~ @fmeum happy to provide a redacted profile, but starlark_cpu_profile is disabled on windows (#13748). Is there another way I can provide some data? Another thought; would it be hard to make me a trial bazel build using some other character that is not ~ - e.g a x? I assume the character is not hardcoded in many places? |
We have some new_local_repositories defined inside module extensions that appear to end up with a simple name on the filesystem and don't trigger this issue. Are there other ways to get simple names besides new_local_repository? |
@peakschris I created this branch based on 7.2.1rc2 that uses |
Thank you! This isn't working:
I wonder if windows has some oddities around trailing dots in directory names:
Dots in the middle seem fine, but dots at the end cause issues:
|
"+" seems to work on windows anywhere in filename without quoting in shell:
|
I will make a local change to + and retry, now I know where the code changes should go |
|
I tested:
It fixes the issue. |
@bazel-io flag |
@peakschris Thanks for testing this. It looks like we need to switch to a different scheme. |
@fmeum you're welcome, glad to get to the bottom of this. Would this be a breaking change, behind a flag? As an aside, when I'm building bazel should I expect |
Technically it wouldn't be as the docs clearly state that the particular naming scheme is an implementation detail, but due to limitations of the API users started to rely on it. Since the regression is so severe and silent, I do think that we need to fix it even in 7.2. I've noticed this target being very slow to build on Windows, but not to that extent (a few minutes on my regular laptop). |
Instead of relying on a particular separator char such as `~`, we instead only rely on the guaranteed fact that the apparent name of an extension repo is the last component of its canonical name. Prepares for bazelbuild/bazel#22865
Instead of relying on a particular separator char such as `~`, we instead only rely on the guaranteed fact that the apparent name of an extension repo is the last component of its canonical name. Prepares for bazelbuild/bazel#22865
@bazel-io fork 7.3.0 |
There are two further lines that need changing in src\main\java\com\google\devtools\build\lib\bazel\bzlmod\ModuleExtensionId.java |
@peakschris Thank you so much for catching this and digging into the root cause.
So we can confirm that disabling 8.3 filenames on the volume doesn't fix this bug, right? |
@meteorcloudy that's correct, disabling 8.3 filenames does not fix this bug |
* Remove reliance on specific canonical repo name scheme Instead of relying on a particular separator char such as `~`, we instead only rely on the guaranteed fact that the apparent name of an extension repo is the last component of its canonical name. Prepares for bazelbuild/bazel#22865 * Update go_repository_config.bzl
Description of the bug:
We have had a curious regression in compile speed for the last 3 weeks. Whilst previously our compiles loaded 40 local cpus to 100%, after the regression cpus were only working at ~25% and compile times increased by 5x (3h to 15h)
I have spent ages trying to figure this out. Tried multiple windows machines, msvc and clang-cl, profiled the build, tested the filesystem, tried a ramdisk, multiple bazel versions...
I've finally narrowed it down to a reproducible example. It happened when I converted all our C++ external repos from workspace to module via use_repo_rule. I think it may be due to the tilde's (~) in the include paths. Perhaps it's an MSVC bug, but it also impacts clang-cl builds which is curious. When I run the Maybe it is a windows bug?
I can't share the code, but can share what we changed and the performance characteristics. This is a tiny example of low level code so only shows a 40% degradation. With 50 repos in lower level code the impact is much larger.
With workspace repo (30s)
The flat peak is the time when the compiles are all happening and cpus are loaded 100%
With one repo defined with use_repo_rule in MODULE.bazel (44s):
The CPUs never load at 100%
Build file, same in before and after:
Before: OurTools declared with a rule that calls download_and_extract in WORKSPACE
After: this is in MODULE.bazel:
The reason this may cause a compile time difference is the include path. We use params files, the relevant differences are:
Workspace
Module & use_repo_rule:
Which category does this issue belong to?
C++ Rules, External Dependency
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I can't share my reproducer as it is proprietary.
Which operating system are you running Bazel on?
Windows 10
What is the output of
bazel info release
?7.2.0
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
This is not a regression
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: