xerial / sqlite-jdbc

SQLite JDBC Driver
Apache License 2.0
2.86k stars 619 forks source link

GraalVM: 'org.sqlite.util.ProcessRunner' was found in the image heap. #1158

Closed BLCK-B closed 3 months ago

BLCK-B commented 3 months ago

Describe the bug nativeCompile results in an error. Suggested fix --initialize-at-build-time=org.sqlite.util.ProcessRunner works, so the issue is not breaking.

To Reproduce https://github.com/BLCK-B/sqlite-graal-issue GraalVM 24.0.2 - Java 22.0.2

Logs Error: An object of type 'org.sqlite.util.ProcessRunner' was found in the image heap. This type, however, is marked for initialization at image run time for the following reason: classes are initialized at run time by default. This is not allowed for correctness reasons: All objects that are stored in the image heap must be initialized at build time.

The following detailed trace displays from which field in the code the object was reached.
Detailed message:
Trace: Object was reached by
  reading static field org.sqlite.util.OSInfo.processRunner
    at org.sqlite.util.OSInfo.getHardwareName(OSInfo.java:164)
  parsing method org.sqlite.util.OSInfo.getHardwareName(OSInfo.java:164) reachable via the parsing context
    at org.sqlite.util.OSInfo.resolveArmArchType(OSInfo.java:173)
    at org.sqlite.util.OSInfo.getArchName(OSInfo.java:253)
    at org.sqlite.util.OSInfo.getNativeLibFolderPathForCurrentOS(OSInfo.java:111)
    at org.sqlite.SQLiteJDBCLoader.loadNativeLibrary(SQLiteJDBCLoader.java:273)
    at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:345)
    at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:75)
    at org.sqlite.core.NativeDB.load(NativeDB.java:69)
    at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:280)
    at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:67)
    at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)
    at com.oracle.svm.core.code.FactoryMethodHolder.JDBC4Connection_constructor_a84323d33dcdbf5002f28e7925fa38bcccf91d2c(generated:0)
    at org.sqlite.JDBC.createConnection(JDBC.java:106)
    at org.sqlite.JDBC.connect(JDBC.java:79)
    at java.sql.DriverManager.getConnection(DriverManager.java:682)
    at java.sql.DriverManager.getConnection(DriverManager.java:253)
    at com.example.demo.DemoApplication.main(DemoApplication.java:16)
    at com.oracle.svm.core.JavaMainWrapper.invokeMain(JavaMainWrapper.java:182)
    at com.oracle.svm.core.JavaMainWrapper.runCore0(JavaMainWrapper.java:233)
    at com.oracle.svm.core.JavaMainWrapper.doRun(JavaMainWrapper.java:301)
    at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
    at static root method.(Unknown Source)

Environment (please complete the following information):

gotson commented 3 months ago

@kkriske is our resident GraalVM SME, maybe he can have a look at this

kkriske commented 3 months ago

See #1159 for explanation and fix