oracle/graal

[native-image] server usage doesn't produce reliable images across builds

aclement opened this issue · 4 comments

I have my simplest spring app. If I compile with --no-server I always get the same image and same output. If I try to run with a server, my image changes size across multiple builds and the output from my app changes. Here are two images built in sequence with the server:


Compile with server, first build (69 seconds):

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::

Dec 06, 2019 4:07:41 PM org.springframework.boot.StartupInfoLogger logStarting
INFO: Starting CommandlinerunnerApplication on Andys-MacBook-Pro-2018.local with PID 51764 (/Users/aclement/gits/spring-graal-native/spring-graal-native-samples/commandlinerunner/clr started by aclement in /Users/aclement/gits/spring-graal-native/spring-graal-native-samples/commandlinerunner)
Dec 06, 2019 4:07:41 PM org.springframework.boot.SpringApplication logStartupProfileInfo
INFO: No active profile set, falling back to default profiles: default
Dec 06, 2019 4:07:41 PM org.springframework.boot.StartupInfoLogger logStarted
INFO: Started CommandlinerunnerApplication in 0.041 seconds (JVM running for 0.045)
CLR running!

real    0m0.136s
user    0m0.032s
sys     0m0.022s

Compile with server, second build (48s):

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::

CLR running!

real    0m0.138s
user    0m0.035s
sys     0m0.021s

Notice all the logging is gone in the second image. To recreate:

git clone https://github.com/spring-projects-experimental/spring-graal-native
cd spring-graal-native/spring-graal-native-feature
git checkout upgrade_19_3
mvn clean package
cd ../spring-graal-native-samples/commandlinerunner
Modify compile.sh to remove --no-server then run it.

Forgot to say, this is mac (pre catalina) with dev build of graal (commit #5a9edeb3ef) on Java 11 base.

FYI I am not able to build spring-graalvm-native in a reliable way without --no-server using GraalVM 20.1.0 so we are going to use this option by default for now.

see #2598

close with #2598