Graal: native-image build failed with a org.graalvm.compiler.java.JsrNotSupportedBailout: unstructured control flow

Created on 23 Sep 2019  路  13Comments  路  Source: oracle/graal

I try to build native-image for a project which used HikariCP and mysql. I just tested with windows.The release 19.2.0 is everything ok, but the latest master branch (2019-9-23) get error:

Error: Unsupported features in 3 methods
Detailed message:
Error: unstructured control flow ([108] [108, 27])
Call path from entry point to com.mysql.jdbc.NetworkResources.forceClose():
at com.mysql.jdbc.NetworkResources.forceClose(NetworkResources.java:47)
at com.mysql.jdbc.MysqlIO.forceClose(MysqlIO.java:487)
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4206)
at com.mysql.jdbc.StatementImpl$CancelTask$1.run(StatementImpl.java:110)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:478)
at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:136)
at com.oracle.svm.core.code.IsolateEnterStub.WindowsJavaThreads_osThreadStartRoutine_4bc03aa26f8cdfc97ebd54050e8ae4bce1023851(generated:0)
Original exception that caused the problem: org.graalvm.compiler.java.JsrNotSupportedBailout: unstructured control flow ([108] [108, 27])
at org.graalvm.compiler.java.BciBlockMapping.createJsrAlternatives(BciBlockMapping.java:805)
at org.graalvm.compiler.java.BciBlockMapping.createJsrAlternatives(BciBlockMapping.java:830)
at org.graalvm.compiler.java.BciBlockMapping.createJsrAlternatives(BciBlockMapping.java:830)
...

The full log is too long and I will upload a file.
errorlog.txt

I think this is related to #1563 . Maybe something @dougxc changed to fix the issue caused this bug.
To reproduce: addcom.zaxxer:HikariCP:3.3.1
mysql:mysql-connector-java:5.1.48
to dependencies, and a main like:

public static void main(String[] args){
HikariConfig config = new HikariConfig();
HikariDataSource HIKARI_DATA_SOURCE = new HikariDataSource(config);
HIKARI_DATA_SOURCE.getConnection();
}

then build it as native-image.

bug

Most helpful comment

openjdk8u212 I used. It works well with the release 19.2.0 and wrong at current master branch.I tried to revert the class org.graalvm.compiler.java.JsrScope to the release branch and then it works. So I think it's the changed code caused the bug.

All 13 comments

What was the Java source to bytecodes compiler used to create the class files? It seems like the Java bytecodes contain an unstructured use of the JSR bytecode.

openjdk8u212 I used. It works well with the release 19.2.0 and wrong at current master branch.I tried to revert the class org.graalvm.compiler.java.JsrScope to the release branch and then it works. So I think it's the changed code caused the bug.

The problematic code is in this jar: https://search.maven.org/artifact/mysql/mysql-connector-java/5.1.48/jar
I'll have a look into this.

And alos the mysql-connector-java:5.1.40 has the same problem. https://search.maven.org/search?q=g:mysql%20AND%20a:mysql-connector-java%20AND%20v:5.1.40

We have identified the issue and are preparing a fix.

Seems like those JAR files were created with Java 1.5?

mysql-connector-j was created with Java 8 but the target bytecode version is 1.5

Can you rerun it with target bytecode version 1.6 or higher; ideally just 8?

Sorry, I just get it from maven. I tried to compile it from source before, but it's too hard and I gived
up :X.

OK, trying to make this work while preserving my sanity. The JSR bytecode patterns generated by those ancient Java versions are difficult to process.

Not meaning to hijack the thread but, I also wonder if Microsoft's SQLServer Driver is built/compiled a similar manner, as I'm also getting several:

Error: Unsupported features in 13 methods
Detailed message:
Error: Parameter 1 of com.microsoft.sqlserver.jdbc.SSPIAuthentication.findRealmFromHostname(SSPIAuthentication$RealmValidator, String) has declared type com.microsoft.sqlserver.jdbc.SSPIAuthentication$RealmValidator which is incompatible with types in state: 1TypeMObject<[0x000012E400010BBA:!S:SSPIAuthentication$1]>
Call path from entry point to com.microsoft.sqlserver.jdbc.SSPIAuthentication.findRealmFromHostname(SSPIAuthentication$RealmValidator, String):

I'm trying to native compile an app that includes the com.microsoft.sqlserver:mssql-jdbc:7.4.1.jre8 artifact.

Is this fixed now? Will the fix be available in 19.3 release?

This changeset should fix the issue: https://github.com/oracle/graal/commit/10eb4ac00551a02abf1f678448e6c6a07651522f

And yes, as far as I can see this made it into 19.3 in a last minute backport effort.

Was this page helpful?
0 / 5 - 0 ratings