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

Docs for Continuous cache invalidation #3096

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/modules/ROOT/pages/Installation_IDE_Support.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,35 @@ You can increase the verbosity of that log file, when you run Mill with
mill --debug mill.bsp.BSP/install
----

=== BSP Gotchas: Mismatching JVM versions

A common issue for poor performance can be a mismatch of the JVMs.
In such a case the Mill BSP server started by a BSP client like Metals is using a _different_ JVM than `mill` is using when started from the command line.
In such a scenario, every Mill invocation using the other JVM will inadvertently invalidate Mills target caches.
This effectively leads to full reevaluation of all invoked Mill targets and appears as "bad performance".

To detect if this is the case,

1. import the project in the BSP client.
2. Wait until the BSP import process has finished.
3. Then run `mill __.compile` in the terminal.
4. Now watch the IDE, to see if the compile command invoked in the terminal has triggered compilation on the build server.

If this happens, you're using different JVMs.
Unfortunately, this is rather difficult to "defend" programmatically in Mill itself.
It is an explicit design goal of Mill, that it should work in different environments.
It is evident and likely unintentional that you have two conflicting local environments.

To fix this it's required to find where this difference stems from.
As a starting point,

* Find out which JVM is used for Mill on the CLi. `mill --version` reports its JVM.

* Search the `.bsp/mill-bsp.stderr` file for a line starting with `"Updating Evaluator"`.
It should contain all env variables (particularly `JAVA_HOME`) used by the BSP server.

Once you found and fixed that and the environments are the same, `clean` and restarting BSP should work as expected.


=== Using Bloop (standalone BSP server)

Expand Down