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

Daemon reuse ignores differences in .mvn/jvm.config #576

Closed
electrum opened this issue Jan 9, 2022 · 3 comments
Closed

Daemon reuse ignores differences in .mvn/jvm.config #576

electrum opened this issue Jan 9, 2022 · 3 comments
Assignees
Milestone

Comments

@electrum
Copy link

electrum commented Jan 9, 2022

I was experimenting with adding the --add-exports lines to .mvn/jvm.config to make Error Prone work without requiring <fork>true</fork>, in order to gain the benefits of the compiler warming up. This seems to work, but mvnd reuses a daemon with different JVM flags.

Reproduce:

  1. Do a build with a single JVM config like -Xmx1G
  2. Add another JVM config like --add-exports=...
  3. Do another build and notice it incorrectly reuses the existing daemon
@gnodet
Copy link
Contributor

gnodet commented Jan 10, 2022

The reason is that mvnd is not aware of all possible JVM options and which one should be discriminating and which one would allow reusing a daemon, so it only knows about a subset of options.
Options that should be discriminating can be added using the mvnd.jvmArgs system property which can be set in the .mvn/mvnd.properties configuration file. I guess things could be improved a bit...

@electrum
Copy link
Author

What are some examples of options that would allow reusing a daemon? I can see that treating -Xmx as a minimum would allow reuse (the existing daemon has a larger max heap), but in general, it seems that reuse should not be allowed.

Is having different JVM options a common use case where we would want to try to reuse the daemon?

@gnodet
Copy link
Contributor

gnodet commented Jan 11, 2022

What are some examples of options that would allow reusing a daemon? I can see that treating -Xmx as a minimum would allow reuse (the existing daemon has a larger max heap), but in general, it seems that reuse should not be allowed.

Is having different JVM options a common use case where we would want to try to reuse the daemon?

Not really. The problem is more to identify which command line options that are discriminating, but I think all JVM options are, but we don't have any simply way to list them all really.
That's why mvnd.jvmArgs is discriminating, as it's name indicates you should give JVM options, while MAVEN_OPTS can contain system properties or other non discriminating properties.
That said, .mvn/jvm.config is supposed to contain JVM options, so it should really be discriminating.

@gnodet gnodet self-assigned this Jan 11, 2022
@gnodet gnodet added this to the 0.7.2 milestone Jan 11, 2022
@gnodet gnodet closed this as completed in 62d580b Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants