Git Product home page Git Product logo

Comments (18)

sdeleuze avatar sdeleuze commented on September 12, 2024 41

Spring Fu minimal webapp is now compiling to a native image successfully with Graal 1.0.0.RC2, Kotlin 1.2.60 (will also work with 1.2.51) and Netty!!!

Startup time is 33 ms with Graal (to be compared with 900 ms with Java 10). The self-sufficient executable size is 50 MB but we will maybe be able to reduce it via #34.

Jetty also works.

from spring-fu.

cstancu avatar cstancu commented on September 12, 2024 1

@sdeleuze RC6 should come out in 1 week or less.

from spring-fu.

sdeleuze avatar sdeleuze commented on September 12, 2024 1

@cstancu Awesome thanks

from spring-fu.

sdeleuze avatar sdeleuze commented on September 12, 2024 1

I reopen this issue since oracle/graal#655 regression makes it impossible to compile a Spring Fu webapp with Graal 1.0.0-RC6.

from spring-fu.

rivasdiaz avatar rivasdiaz commented on September 12, 2024

Kotlin ticket: https://youtrack.jetbrains.net/issue/KT-23962

from spring-fu.

sdeleuze avatar sdeleuze commented on September 12, 2024

With KT-23962 and graal#416 now fixed we should now give it another try.

from spring-fu.

sdeleuze avatar sdeleuze commented on September 12, 2024

I think we are quite close to get it working. On this branch with Graal 1.0.0.RC2, the executable is created and throw this exception when running:

Exception in thread "main" java.lang.reflect.InvocationTargetException
	at java.lang.Throwable.<init>(Throwable.java:310)
	at java.lang.Exception.<init>(Exception.java:102)
	at java.lang.ReflectiveOperationException.<init>(ReflectiveOperationException.java:89)
	at java.lang.reflect.InvocationTargetException.<init>(InvocationTargetException.java:72)
	at com.oracle.svm.reflect.proxies.Proxy_94_ApplicationKt_main.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:173)
Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: RuntimeMXBean methods
	at java.lang.Throwable.<init>(Throwable.java:265)
	at java.lang.Error.<init>(Error.java:70)
	at com.oracle.svm.core.jdk.UnsupportedFeatureError.<init>(UnsupportedFeatureError.java:31)
	at com.oracle.svm.core.jdk.Target_com_oracle_svm_core_util_VMError.unsupportedFeature(VMErrorSubstitutions.java:105)
	at com.oracle.svm.core.jdk.SubstrateRuntimeMXBean.getUptime(JavaManagementSubstitutions.java:238)
	at org.springframework.fu.ApplicationDsl.run(ApplicationDsl.kt:181)
	at org.springframework.fu.ApplicationDsl.run$default(ApplicationDsl.kt:164)
	at org.springframework.fu.sample.minimal.ApplicationKt.main(Application.kt:35)
	... 3 more

Not sure yet how we could avoid using RuntimeMXBean methods to avoid this error.
Any thoughts @dsyer @jhoeller?

from spring-fu.

sdeleuze avatar sdeleuze commented on September 12, 2024

Good news, KT-23962 will be fixed in upcoming Kotlin 1.2.51.

from spring-fu.

Peter-B-Kessler avatar Peter-B-Kessler commented on September 12, 2024

Thanks for finding a (previously) unused corner of the SubstrateVM runtime. I have filed an issue to implement RuntimeMXBean.getUptime(). Not all of the RuntimeMXBean methods make sense in the context of a native image. Are there others you need, and what do you think they should they should return?

from spring-fu.

sdeleuze avatar sdeleuze commented on September 12, 2024

@Peter-B-Kessler Thanks! In Spring Boot, we use getName() (to get the PID) and getClassPath() (which could maybe be replaced by System.getProperty("java.class.path")) in addition to getUptime(). Do you think those would make sense with SubstrateVM runtime?

from spring-fu.

Peter-B-Kessler avatar Peter-B-Kessler commented on September 12, 2024

RuntimeMXBean.getName() already returns the "expected" pid@hostname. (At some point we will support JDK-9 and the ProcessHandle.pid() method and I will sleep better.)

RuntimeMXBean.getClassPath() should return null because there is no path from which SubstrateVM loads classes at runtime. Similarly RuntimeMXBean.getBootClassPath() should return null.

When I implement RuntimeMXBean.getUptime() I will see what can be done for the rest of the RuntimeMXBean methods.

from spring-fu.

sdeleuze avatar sdeleuze commented on September 12, 2024

Ok thanks a lot!

from spring-fu.

sdeleuze avatar sdeleuze commented on September 12, 2024

@Peter-B-Kessler Any chance you could notice me when this is on GraalVM master in order to allow me to try it and make progress on the Boot side as well?

from spring-fu.

Peter-B-Kessler avatar Peter-B-Kessler commented on September 12, 2024

The changes are in https://github.com/oracle/graal/blob/master/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JavaManagementSubstitutions.java. I don't know what the release schedule is for the next set of built binaries. You could build from sources by following the instructions in https://github.com/oracle/graal/blob/master/substratevm/README.md.

You might be disappointed that getClassPath() returns null, but that is the correct value for it to return: there is no class path at runtime.

getUptime() (and getStartTime()) depend on a startup hook that runs if your application is called from the usual static void main(String[]) entry point. If you embed SubstrateVM in another application and start it from a different entry point, to get reasonable answers from those methods you will have to call those startup hooks yourself, via RuntimeSupport.executeStartupHooks().

from spring-fu.

sdeleuze avatar sdeleuze commented on September 12, 2024

Make sense thanks.

Next issue we face: oracle/graal#507

from spring-fu.

sdeleuze avatar sdeleuze commented on September 12, 2024

I have updated graal branch in order to leverage GraalVM 1.0 RC3. Sadly we have a regression under investigation, see https://twitter.com/sdeleuze/status/1014051429621862400. For now, I have updated the branch to leverage Jetty instead.

from spring-fu.

sdeleuze avatar sdeleuze commented on September 12, 2024

Related Spring Framework issue for GraalVM native image support is SPR-16991.

from spring-fu.

sdeleuze avatar sdeleuze commented on September 12, 2024

@Peter-B-Kessler @cstancu Any plan to release a RC6 shortly? It would allow our user to create Spring Fu apps that works out of the box as native images.

from spring-fu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.