-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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 hangs when compiling large no of databinding modules #12780
Comments
We also have a large app with lots of modules and are seeing this as well during the analysis phase. |
I renamed the issue to better describe the problem. It seems even @Bencodes this hacky fix filters the duplicates and lets bazel proceed to execution phase. Related #2694 |
@ahumesky Have you had a look at this? This will probably be a blocker for folks trying to switch over to the |
Thanks for the very detailed report, I took a look at the repro, and it shouldn't be too bad to fix this. If I recall correctly, the setterstore and classinfo files were supposed to be per-target only, so a list would do, but clearly in the case of a very long string of exports, it will grow quickly. |
See #11497 (comment) #12780 RELNOTES: None PiperOrigin-RevId: 387460397
…attributes class_infos and setter_stores from lists to depsets. See bazelbuild/bazel@876d48d bazelbuild/bazel#11497 (comment) bazelbuild/bazel#12780
…attributes class_infos and setter_stores from lists to depsets. (#38) See bazelbuild/bazel@876d48d bazelbuild/bazel#11497 (comment) bazelbuild/bazel#12780
I've submitted a couple changes that should address some of this problem. and android rules including bazelbuild/rules_android@9b6935e (Also, bazel at head enables validation actions by default, and there's a problem with the aar_import_checks stub action in the android rules (the real aar_import_checks isn't open sourced yet), and until that's fixed, you'll need to pass |
Thanks @ahumesky will test and report back. |
I tested in our project and can confirm Bazel does not hang anymore. |
Excellent, thank you for confirming! |
See bazelbuild/bazel#11497 (comment) bazelbuild/bazel#12780 RELNOTES: None PiperOrigin-RevId: 387460397
Description of the problem / feature request:
We have a large app, 1000+ modules with many of them using databinding and encountered few issues due to usage of lists to propagate databinding data among dependencies. This leads to two issues mainly
Feature requests: what underlying problem are you trying to solve with this feature?
Analysing the issue, current implementation of DatabindingV2Provider uses lists to propagate databinding data namely classInfos and setterStores.
This has problems when
exports
are used in the project, as it is currently done in Kotlin support . When exports are used, the list can contain duplicates which are not filtered at each stage and we seem to hit the problem described here. This causes problems in two places.GEN_BASE_CLASSES
, the-dependencyClassInfoList
argument can contain lot of duplicates which for a sufficiently large graph can cause argument length to exceed Kernel limit. See [ERROR] Android data-binding. 'Argument list too long' / 'Method too large' #12697. Even if it does not crash for small apps, I believe this has implications on performance as well, since Databinding exec would do lot of duplicate work in this case.setterStores
duplicates which causes the analysis hang and eventual OOM described above.Applying the same duplicate filter to setter stores fixed both of the issues and entire app can be built. Patch file for attempted duplicate filtering fix. However I understand filtering duplicates is not an ideal solution, and wanted to propose using NestedSets just like how
transitiveLabelAndJavaPackages
are currently propogated.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Consider this dependency graph.
Here if
B
exportsD
andC
also exportsD
then in A's action there are duplicates in bothsetterStores
andclassInfos
which causes this issue.Repro steps:
bazelisk build -s app
//:A
As you can see
bazel-out/android-armeabi-v7a-fastbuild/bin/databinding/D/class-info.zip
is being repeated twice, this problem is exacerbated on larger graphs eventually leading to kernel limit.What operating system are you running Bazel on?
MacOS Mojave
What's the output of
bazel info release
?release 4.0.0rc7
If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.NA
What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?NA
Have you found anything relevant by searching the web?
https://docs.bazel.build/versions/master/skylark/performance.html#use-depsets
https://stackoverflow.com/questions/11289551/argument-list-too-long-error-for-rm-cp-mv-commands
Any other information, logs, or outputs that you want to share?
.bazelrc
The text was updated successfully, but these errors were encountered: