Open keithl-stripe opened 2 years ago
We recently added our Python code to Bazel in our monorepo (which was previously just managed Java & Scala via Bazel). Intellij now freezes when it starts refreshing files and eventually crashes due to out of memory errors. Every time this happened, I bumped the memory up by 1GB to see if that would fix it. I'm up to 6GB now and it just takes longer to crash.
To corroborate this bug report, I ran dtruss
on Intellij and confirmed that when the IDE locks up it is scanning all the files in the execroot. These directories are all excluded via Intellij.
# ij.bazelproject
directories:
.
-bazel-bin
-bazel-dataworks
-bazel-genfiles
-bazel-out
-bazel-testlogs
targets:
//...:all
java_language_level: 8
additional_languages:
scala
Since adding a hermetic Python install to Bazel, the scanning is now nearly impossible to deal with.
My "workaround" is to run a bazel clean
every morning and every time I switch modules. Then I "partially sync" the folder I am working on, and while it still scans the files it completes after a few minutes when just indexing a single module.
Hello @keithl-stripe & @dfinninger, Could you please confirm if you are still seeing the above performance issue even with the latest intellij and bazel plugin releases. Thanks!
I believe I'm up to date on minor versions (probably a few patches behind), and I'm still seeing the issue. However I'm on PTO this week so I won't be able to test for a little bit.
I'll upgrade next week and try it out again.
@sgowroji I've updated to the latest versions I could get in the Jetbrains Toolbox app.
IDEA Version: IntelliJ IDEA 2022.2.3 (Ultimate Edition), Build #IU-222.4345.14, built on October 4, 2022
Bazel Plugin version: 2022.09.20.0.1-api-version-222
And while indexing I still see it looking through my excluded Bazel directories:
❯ sudo dtruss -p 21559 | grep _bazel_dfinninger | grep getattrlist
getattrlist("/private/var/tmp/_bazel_dfinninger/e0de62c3aa2a01df70346b0386e30cf1/execroot/REDACTED/bazel-out/darwin-fastbuild/bin/REDACTED/src\0", 0x7FF8093C41E4, 0x70000DEECEF0) = 0 0
getattrlist("/private/var/tmp/_bazel_dfinninger/e0de62c3aa2a01df70346b0386e30cf1/execroot/REDACTED/bazel-out/darwin-fastbuild/bin/REDACTED/src/main\0", 0x7FF8093C41E4, 0x70000DEECEF0) = 0 0
getattrlist("/private/var/tmp/_bazel_dfinninger/e0de62c3aa2a01df70346b0386e30cf1/execroot/REDACTED/bazel-out/darwin-fastbuild/bin/REDACTED/src/main/python\0", 0x7FF8093C41E4, 0x70000DEECEF0) = 0 0
getattrlist("/private/var/tmp/_bazel_dfinninger/e0de62c3aa2a01df70346b0386e30cf1/execroot/REDACTED/bazel-out/darwin-fastbuild/bin/REDACTED/src/main/python/print.runfiles\0", 0x7FF8093C41E4, 0x70000DEECEF0) = 0 0
... etc ...
Thank you for contributing to the IntelliJ repository! This issue has been marked as stale since it has not had any activity in the last 6 months. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-maintainer". Please reach out to the triage team (@bazelbuild/triage
) if you think this issue is still relevant or you are interested in getting the issue resolved.
This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team (@bazelbuild/triage
). Thanks!
@bazelbuild/triage - I'm having trouble understanding why this issue was autoclosed. What's the underlying thinking here?
The users responded promptly to every request for more data or more information, all was given, and the issue was added to Bazel backlog.
@mai93 since that alias linked in the comment above apparently did not resolve to a team.
And @sgowroji
What's the customer obsessed reason to have the bot do this when all action is pending on Bazel team?
This could be fixed now with IntelliJ 2024.1 and after #6094 is merged. There is more context in IDEA-333933.
@tpasternak can you please confirm?
There are multiple factors that might impact it, but I believe the worst one is already fixed
I am facing the same issue with IntelliJ 2024.1 my bazel sync is stuck in refreshing files and is taking more than 3 hours to complete a small sync
hey @piyush-golani
3 hours is indeed enormous size. It looks like you are working on a really large codebase. Could you try to reduce the scope by manipulating targets
/directories
sections in the projectview file? Also, we still don't support non-default convenience symlink locations
Some engineers here at Stripe are seeing IntelliJ spend many minutes performing "Refreshing files." This often happens after every Bazel IntelliJ sync.
When we pause IntelliJ in the debugger, we see that it's stuck indexing the execution root for the Bazel workspace:
(This behavior appears to have been changed – or maybe introduced – in #1703, though I'm not sure how (or why).)
On my laptop, this means it's refreshing (or reindexing?) hundreds of thousands of files:
Most of the CPU is spent just traversing the files:
If I set a logging-only breakpoint in
com.intellij.openapi.vfs.VirtualFileVisitor.visitFileEx
I see it visiting runfiles for hundreds of tests:Some questions I have:
bazel-<workspacename>
,bazel-out
symlinks relevant? We usually usedirectories: .
in our.bazelproject
which may inadvertently be causing this problem.bazelproject
file to havedirectories:
contain a list of all subdirectories exceptbazel-*
?The IntelliJ plugin developer docs suggest we cannot just add those to some kind of ignore/exclude list:
However the IntelliJ product docs say otherwise: