gluonhq / substrate

Create native Java(FX) apps for desktop, mobile and embedded
GNU General Public License v2.0
395 stars 51 forks source link

[windows] NullPointerException: Cannot invoke "AllInstantiatedTypeFlow.addState(PointsToAnalysis, TypeState)" because "t.instantiatedTypes" is null #1142

Open st4s1k opened 2 years ago

st4s1k commented 2 years ago

I get a NPE when trying to build the project. It appeared after I tried to integrate spring-boot into the project. I had other issues which I fixed by creating this file resources/META-INF/substrate/config/initbuildtime but then the current issue appeared.

Expected Behavior

The build should not throw a NPE

Current Behavior

The build throws a NPE

[Mon Apr 04 00:56:12 EEST 2022][INFO] [SUB] [3/7] Building universe...                                                                               (4.9s @ 5.67GB)
[Mon Apr 04 00:56:19 EEST 2022][INFO] [SUB] [4/7] Parsing methods...      [***]                                                                      (6.5s @ 2.94GB)
[Mon Apr 04 00:56:28 EEST 2022][INFO] [SUB] [5/7] Inlining methods...     [*****]                                                                    (8.1s @ 2.83GB)
[Mon Apr 04 00:56:59 EEST 2022][INFO] [SUB] [6/7] Compiling methods...    [*****]                                                                   (31.1s @ 4.27GB)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB] [7/7] Creating image...
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB] Fatal error: com.oracle.svm.core.util.VMError$HostedError: java.lang.NullPointerException: Cannot invoke "com.oracle.graal.pointsto.flow.AllInstantiatedTypeFlow.addState(com.oracle.graal.pointsto.PointsToAnalysis, com.oracle.graal.pointsto.typestate.TypeState)" because "t.instantiatedTypes" is null
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:72)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:656)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:494)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:426)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:587)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:126)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:617)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB] Caused by: java.lang.NullPointerException: Cannot invoke "com.oracle.graal.pointsto.flow.AllInstantiatedTypeFlow.addState(com.oracle.graal.pointsto.PointsToAnalysis, com.oracle.graal.pointsto.typestate.TypeState)" because "t.instantiatedTypes" is null
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisType.lambda$registerAsInstantiated$4(AnalysisType.java:443)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisType.forAllSuperTypes(AnalysisType.java:526)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisType.forAllSuperTypes(AnalysisType.java:512)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisType.forAllSuperTypes(AnalysisType.java:508)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisType.registerAsInstantiated(AnalysisType.java:442)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisType.registerAsAllocated(AnalysisType.java:425)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisType.markReachable(AnalysisType.java:482)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisType.forAllSuperTypes(AnalysisType.java:526)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisType.forAllSuperTypes(AnalysisType.java:512)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisType.forAllSuperTypes(AnalysisType.java:508)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisType.registerAsReachable(AnalysisType.java:466)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.registerAsReachable(AnalysisConstantReflectionProvider.java:290)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.ameta.HostedDynamicHubFeature.replace(HostedDynamicHubFeature.java:53)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisUniverse.replaceObject(AnalysisUniverse.java:575)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.image.NativeImageHeap.addArrayElements(NativeImageHeap.java:576)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.image.NativeImageHeap.addObjectToImageHeap(NativeImageHeap.java:473)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.image.NativeImageHeap.addObject(NativeImageHeap.java:295)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.image.NativeImageHeap.processAddObjectWorklist(NativeImageHeap.java:598)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.image.NativeImageHeap.addTrailingObjects(NativeImageHeap.java:198)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:638)
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]     ... 5 more
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]                        22.0s (13.9% of total time) in 101 GCs | Peak RSS: 9.66GB | CPU load: 6.92
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB] Produced artifacts:
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB]  D:\MEGA\Plutus\DEV\LeagueTeamComp\target\gluonfx\x86_64-windows\gvm\LeagueTeamComp\com.st4s1k.leagueteamcomp.leagueteamcompapplication.build_artifacts.txt
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB] ========================================================================================================================
[Mon Apr 04 00:57:05 EEST 2022][INFO] [SUB] Failed generating 'com.st4s1k.leagueteamcomp.leagueteamcompapplication' after 2m 37s.
[Mon Apr 04 00:57:07 EEST 2022][INFO] [SUB] Error: Image build request failed with exit status 1
[Mon Apr 04 00:57:07 EEST 2022][INFO] [SUB] com.oracle.svm.driver.NativeImage$NativeImageError: Image build request failed with exit status 1
[Mon Apr 04 00:57:07 EEST 2022][INFO] [SUB]     at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1770)
[Mon Apr 04 00:57:07 EEST 2022][INFO] [SUB]     at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1477)
[Mon Apr 04 00:57:07 EEST 2022][INFO] [SUB]     at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1438)
[Mon Apr 04 00:57:07 EEST 2022][INFO] [SUB]     at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1425)
[Mon Apr 04 00:57:07 EEST 2022][FINE] Result for compile: 1
[Mon Apr 04 00:57:07 EEST 2022][SEVERE] Process compile failed with result: 1

Steps to Reproduce

  1. checkout this branch https://github.com/st4s1k/League-of-Legends-Team-Composition-Tool/tree/spring-framework-integration
  2. mvn clean gluonfx:runagent gluonfx:build

Your Environment

Platform: Windows 11 JDK: 17 GraalVM: graalvm-svm-java17-windows-gluon-22.0.0.3-Final

st4s1k commented 2 years ago

The only thing that pops up in google is this: https://build-native-java-apps.cc/developer-guide/debug-native-image-generation/

st4s1k commented 2 years ago

I cannot debug GraalVM classes because they are not accessible to me. Maybe there is a way to debug this but I don't know how. When you google Fatal error: com.oracle.svm.core.util.VMError$HostedError: java.lang.NullPointerException: Cannot invoke "com.oracle.graal.pointsto.flow.AllInstantiatedTypeFlow.addState(com.oracle.graal.pointsto.PointsToAnalysis, com.oracle.graal.pointsto.typestate.TypeState)" because "t.instantiatedTypes" is null you literally get 1 (one) search result.

jperedadnr commented 2 years ago

I see that you have posted this as well at the GraalVM issue tracker, which is where it should be. In any case, I've tried your project on Mac, with a more recent GraalVM version, and it fails with a different error:

[Sat Apr 09 15:27:20 CEST 2022][INFO] [SUB] [3/7] Building universe...                                                                               (4.2s @ 4.77GB)
[Sat Apr 09 15:27:24 CEST 2022][INFO] [SUB] [4/7] Parsing methods...      [**]                                                                       (3.9s @ 6.46GB)
[Sat Apr 09 15:27:32 CEST 2022][INFO] [SUB] [5/7] Inlining methods...     [*****]                                                                    (7.6s @ 3.74GB)
[Sat Apr 09 15:27:50 CEST 2022][INFO] [SUB] [6/7] Compiling methods...    [****]                                                                    (18.0s @ 3.37GB)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB] 
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB] [7/7] Creating image...                                                                                  (0.0s @ 4.72GB)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB] Fatal error: com.oracle.svm.core.util.VMError$HostedError: com.oracle.svm.core.util.VMError$HostedError: Registering type as reachable after analysis: AnalysisType<org.springframework.context.ApplicationListener[], allocated: false, inHeap: false, reachable: false>
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:72)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:678)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:515)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:615)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB] Caused by: com.oracle.svm.core.util.VMError$HostedError: Registering type as reachable after analysis: AnalysisType<org.springframework.context.ApplicationListener[], allocated: false, inHeap: false, reachable: false>
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:68)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.registerAsReachable(AnalysisConstantReflectionProvider.java:332)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.ameta.HostedDynamicHubFeature.replace(HostedDynamicHubFeature.java:53)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.graal.pointsto.meta.AnalysisUniverse.replaceObject(AnalysisUniverse.java:582)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.image.NativeImageHeap.addArrayElements(NativeImageHeap.java:576)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.image.NativeImageHeap.addObjectToImageHeap(NativeImageHeap.java:473)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.image.NativeImageHeap.addObject(NativeImageHeap.java:295)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.image.NativeImageHeap.processAddObjectWorklist(NativeImageHeap.java:598)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.image.NativeImageHeap.addTrailingObjects(NativeImageHeap.java:198)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:660)
[Sat Apr 09 15:27:56 CEST 2022][INFO] [SUB]     ... 5 more

which is similar to this one: https://github.com/oracle/graal/issues/4303

st4s1k commented 2 years ago

it seems to be related to my error, something about analysis and type

st4s1k commented 2 years ago

@jperedadnr thanks for additional info

st4s1k commented 2 years ago

GluonHQ ignite doesn't work as well https://github.com/st4s1k/League-of-Legends-Team-Composition-Tool/tree/experimental/spring-framework-integration

https://github.com/st4s1k/League-of-Legends-Team-Composition-Tool/blob/experimental/spring-framework-integration/src/main/java/com/st4s1k/leagueteamcomp/LeagueTeamCompApplication.java