oracle/graal

Disable the image build server by default

christianwimmer opened this issue · 5 comments

The native-image tool has a mode that leaves the Java HotSpot VM performing the image build alive after an image build. Subsequent image builds can reuse that VM, which is then already warmed up and therefore subsequent image builds are faster.

Currently, the build server is enabled by default, and can be disabled using the option --no-server. We propose to flip the default, so that enabling the server requires an opt-in using --experimental-build-server.

While the build server has its uses, it is unfortunately not production quality at this point. We encounter bugs regularly where static state, especially in the JDK, survives from one build to another, leading to strange and hard-to-debug build errors (or even worse, runtime errors of the generated image). For example, #2554 is such a bug that is currently open. Fixing all the issues in a principled manner requires a level of isolation of the JDK that the image generator currently cannot provide: ideally, each image would get its own non-initialized copy of the JDK.

Several frameworks that support Native Image (Spring, Quarkus, Micronaut) already disable the build server by default or encourage users to disable it.

Alternatives:

  • Leave the build server enabled by default, invest constantly in fixing occurring issues, but accepting that new issues cannot be avoided.
  • Remove the code for the image builder completely: At this point, this seems unnecessary.

If anyone has comments or a preference, please comment on this issue.

Sounds good to me

I recommend --no-server to everyone. The build server feels like a repeat of similar workarounds like Nailgun and Drip, and neither of these ever really worked great in practice.

adinn commented

Disabled by default sounds better to me.

Yes please. We use --no-server by default in Micronaut and it always looked to me that it should be the default without any flags. 👍 for this change.

olpaw commented

I'm in favor for flipping the default and making the build server usecase experimental.
Warmup reuse cannot be done safely without the JVM providing proper isolation.