Compiled JavaFX app crashes immediately and silently

93 views Asked by At

After some time I've returned to the native compilation game for JavaFX applications; in the meantime I've build a lot of stuff with JavaFX, but I only rarely touched GraalVM.

After some problems with the setup on Windows I'm now able to compile and link an app (and used rungagent to get all the configs).

The problem now is: The app crashed immediately and without any log whatsoever. When I use nativerun I get:

[Mo. Dez. 18 14:50:31 MEZ 2023][INFORMATION] [SUB] Dez. 18, 2023 2:50:31 PM com.sun.javafx.application.PlatformImpl startup
[Mo. Dez. 18 14:50:31 MEZ 2023][INFORMATION] [SUB] WARNUNG: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @6b71769e'
[Mo. Dez. 18 14:50:34 MEZ 2023][SCHWERWIEGEND] Process run until end failed with result: -1073741819
Check the log files under C:\Users\...\jfx-updater\target\gluonfx\x86_64-windows\gvm\log
And please check https://docs.gluonhq.com/ for more information.
[Mo. Dez. 18 14:50:34 MEZ 2023][INFORMATION] Logging process [run until end] to file: C:\Users\...\jfx-updater\target\gluonfx\log\process-run until end-1702907434372.log

The mentioned logs are devoid of anything useful information:

Process
=======
run until end

Command Line
============
C:\Users\...\jfx-updater\target\gluonfx\x86_64-windows\updater.exe

Output
======
Dez. 18, 2023 2:50:31 PM com.sun.javafx.application.PlatformImpl startup
WARNUNG: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @6b71769e'


Result
======
result: -1073741819

I'm aware of the issue behind the Unsupported JavaFX configuration warning, but this should not be the culprit. Simply just a warning.

The log with the compile run within also look OK to me:

[Mo. Dez. 18 14:02:18 MEZ 2023][INFORMATION] [SUB] Warning: Ignoring server-mode native-image argument --no-server.
[Mo. Dez. 18 14:02:21 MEZ 2023][INFORMATION] [SUB] ========================================================================================================================
[Mo. Dez. 18 14:02:21 MEZ 2023][INFORMATION] [SUB] GraalVM Native Image: Generating 'ch.cnlab.update.mainkt' (shared library)...
[Mo. Dez. 18 14:02:21 MEZ 2023][INFORMATION] [SUB] ========================================================================================================================
[Mo. Dez. 18 14:02:23 MEZ 2023][INFORMATION] [SUB] [1/7] Initializing...                                                                                    (4,1s @ 0,22GB)
[Mo. Dez. 18 14:02:23 MEZ 2023][INFORMATION] [SUB]  Version info: 'GraalVM 22.1.0.1 Java 17 CE'
[Mo. Dez. 18 14:02:23 MEZ 2023][INFORMATION] [SUB]  C compiler: cl.exe (microsoft, x64, 19.38.33133)
[Mo. Dez. 18 14:02:23 MEZ 2023][INFORMATION] [SUB]  Garbage collector: Serial GC
[Mo. Dez. 18 14:02:23 MEZ 2023][INFORMATION] [SUB]  1 user-provided feature(s)
[Mo. Dez. 18 14:02:23 MEZ 2023][INFORMATION] [SUB]   - com.oracle.svm.polyglot.kotlin.KotlinFeature
[Mo. Dez. 18 14:02:48 MEZ 2023][INFORMATION] [SUB] [2/7] Performing analysis...  [*************]                                                           (24,2s @ 4,65GB)
[Mo. Dez. 18 14:02:48 MEZ 2023][INFORMATION] [SUB]   14.135 (91,55%) of 15.440 classes reachable
[Mo. Dez. 18 14:02:48 MEZ 2023][INFORMATION] [SUB]   31.120 (72,74%) of 42.781 fields reachable
[Mo. Dez. 18 14:02:48 MEZ 2023][INFORMATION] [SUB]   72.156 (63,59%) of 113.465 methods reachable
[Mo. Dez. 18 14:02:48 MEZ 2023][INFORMATION] [SUB]      721 classes, 6.078 fields, and 3.234 methods registered for reflection
[Mo. Dez. 18 14:02:48 MEZ 2023][INFORMATION] [SUB]      138 classes,   158 fields, and   208 methods registered for JNI access
[Mo. Dez. 18 14:02:49 MEZ 2023][INFORMATION] [SUB] [3/7] Building universe...                                                                               (1,8s @ 2,39GB)
[Mo. Dez. 18 14:02:50 MEZ 2023][INFORMATION] [SUB] [4/7] Parsing methods...      [*]                                                                        (0,7s @ 3,87GB)
[Mo. Dez. 18 14:02:52 MEZ 2023][INFORMATION] [SUB] [5/7] Inlining methods...     [****]                                                                     (1,2s @ 5,95GB)
[Mo. Dez. 18 14:03:01 MEZ 2023][INFORMATION] [SUB] [6/7] Compiling methods...    [***]                                                                      (9,7s @ 4,16GB)
[Mo. Dez. 18 14:03:08 MEZ 2023][INFORMATION] [SUB] 
[Mo. Dez. 18 14:03:08 MEZ 2023][INFORMATION] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Mo. Dez. 18 14:03:08 MEZ 2023][INFORMATION] [SUB]                         4,8s (9,6% of total time) in 41 GCs | Peak RSS: 9,74GB | CPU load: 5,27
[Mo. Dez. 18 14:03:08 MEZ 2023][INFORMATION] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Mo. Dez. 18 14:03:08 MEZ 2023][INFORMATION] [SUB] Produced artifacts:
[Mo. Dez. 18 14:03:08 MEZ 2023][INFORMATION] [SUB]  C:\Users\...\jfx-updater\target\gluonfx\x86_64-windows\gvm\updater\graal_isolate.h (header)
[Mo. Dez. 18 14:03:08 MEZ 2023][INFORMATION] [SUB]  C:\Users\...\jfx-updater\target\gluonfx\x86_64-windows\gvm\updater\ch.cnlab.update.mainkt.h (header)
[Mo. Dez. 18 14:03:08 MEZ 2023][INFORMATION] [SUB]  C:\Users\...\jfx-updater\target\gluonfx\x86_64-windows\gvm\updater\graal_isolate_dynamic.h (header)
[Mo. Dez. 18 14:03:08 MEZ 2023][INFORMATION] [SUB]  C:\Users\...\jfx-updater\target\gluonfx\x86_64-windows\gvm\updater\ch.cnlab.update.mainkt_dynamic.h (header)
[Mo. Dez. 18 14:03:08 MEZ 2023][INFORMATION] [SUB]  C:\Users\...\jfx-updater\target\gluonfx\x86_64-windows\gvm\updater\ch.cnlab.update.mainkt.build_artifacts.txt
[Mo. Dez. 18 14:03:08 MEZ 2023][INFORMATION] [SUB] ========================================================================================================================
[Mo. Dez. 18 14:03:08 MEZ 2023][INFORMATION] [SUB] Finished generating 'ch.cnlab.update.mainkt' in 49,1s.
[Mo. Dez. 18 14:03:09 MEZ 2023][FEIN] Result for compile: 0
[Mo. Dez. 18 14:03:09 MEZ 2023][FEIN] Logging process [compile] to file: C:\Users\...\jfx-updater\target\gluonfx\log\process-compile-1702904589886.log
[Mo. Dez. 18 14:03:09 MEZ 2023][FEIN] PB Command for check version: C:\SDK\java\gluon\graalvm-svm-java17-windows-gluon-22.1.0.1-Final\bin\java -version
[Mo. Dez. 18 14:03:09 MEZ 2023][FEIN] Start process check version...
[Mo. Dez. 18 14:03:09 MEZ 2023][FEIN] [SUB] openjdk version "17.0.3" 2022-04-19
[Mo. Dez. 18 14:03:09 MEZ 2023][FEIN] [SUB] OpenJDK Runtime Environment GraalVM 22.1.0.1 (build 17.0.3+7-jvmci-22.1-b06)
[Mo. Dez. 18 14:03:09 MEZ 2023][FEIN] [SUB] OpenJDK 64-Bit Server VM GraalVM 22.1.0.1 (build 17.0.3+7-jvmci-22.1-b06, mixed mode, sharing)
[Mo. Dez. 18 14:03:09 MEZ 2023][FEIN]
1

There are 1 answers

0
José Pereda On BEST ANSWER

When running the native image executable on Windows, there might be several reasons for an error -1073741819 (application error 0xc0000005):

Application Error 0xc0000005 (Access Violation) error is usually caused by your computer not being able to correctly process the files and settings required to run a particular program or installation. Despite the error showing when you try and use particular pieces of software, it has many different causes including faulty RAM problems, errors with the files of your PC and issues with the settings of your PC.

For native images of JavaFX applications, one of those file issues could be the presence of wrong dll libraries, like glass.dll, in the path.

There is already an open JBS issue: https://bugs.openjdk.java.net/browse/JDK-8223746 about this.

While that is resolved, you can check the java.library.path env variable and see that it doesn't contain wrong dll files (for instance removing the JavaFX .openjfx cache), or as a quick workaround changing it to point to a different path, like in this commit.

For reference, see these similar issue and issue reported for the GluonFX plugin.