-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe the issue
As reported in quarkusio/quarkus#35994, with a latest Graal master build (24.0-dev) some tests fail with:
Error: Unsupported features in 2 methods
Detailed message:
Error: Discovered unresolved type during parsing: org.apache.commons.logging.LogFactory. This error is reported at image build time because class org.flywaydb.core.internal.logging.apachecommons.ApacheCommonsLogCreator is registered for linking at image build time by command line and command line.
Error encountered while parsing org.flywaydb.core.internal.logging.apachecommons.ApacheCommonsLogCreator.createLogger(ApacheCommonsLogCreator.java:24)
Parsing context:
at static root method.(Unknown Source)
Error: Discovered unresolved type during parsing: org.apache.logging.log4j.LogManager. This error is reported at image build time because class org.flywaydb.core.internal.logging.log4j2.Log4j2LogCreator is registered for linking at image build time by command line and command line.
Error encountered while parsing org.flywaydb.core.internal.logging.log4j2.Log4j2LogCreator.createLogger(Log4j2LogCreator.java:24)
Parsing context:
at static root method.(Unknown Source)
com.oracle.svm.core.util.UserError$UserException: Unsupported features in 2 methods
Detailed message:
Error: Discovered unresolved type during parsing: org.apache.commons.logging.LogFactory. This error is reported at image build time because class org.flywaydb.core.internal.logging.apachecommons.ApacheCommonsLogCreator is registered for linking at image build time by command line and command line.
Error encountered while parsing org.flywaydb.core.internal.logging.apachecommons.ApacheCommonsLogCreator.createLogger(ApacheCommonsLogCreator.java:24)
Parsing context:
at static root method.(Unknown Source)
Error: Discovered unresolved type during parsing: org.apache.logging.log4j.LogManager. This error is reported at image build time because class org.flywaydb.core.internal.logging.log4j2.Log4j2LogCreator is registered for linking at image build time by command line and command line.
Error encountered while parsing org.flywaydb.core.internal.logging.log4j2.Log4j2LogCreator.createLogger(Log4j2LogCreator.java:24)
Parsing context:
at static root method.(Unknown Source)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:85)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:248)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:826)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:593)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:551)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:538)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:720)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:142)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:97)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported features in 2 methods
Detailed message:
Error: Discovered unresolved type during parsing: org.apache.commons.logging.LogFactory. This error is reported at image build time because class org.flywaydb.core.internal.logging.apachecommons.ApacheCommonsLogCreator is registered for linking at image build time by command line and command line.
Error encountered while parsing org.flywaydb.core.internal.logging.apachecommons.ApacheCommonsLogCreator.createLogger(ApacheCommonsLogCreator.java:24)
------------------------------------------------------------------------------------------------------------------------
Parsing context:
at static root method.(Unknown Source)
Error: Discovered unresolved type during parsing: org.apache.logging.log4j.LogManager. This error is reported at image build time because class org.flywaydb.core.internal.logging.log4j2.Log4j2LogCreator is registered for linking at image build time by command line and command line.
Error encountered while parsing org.flywaydb.core.internal.logging.log4j2.Log4j2LogCreator.createLogger(Log4j2LogCreator.java:24)
Parsing context:
at static root method.(Unknown Source)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:129)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:821)
... 6 more
See:
https://github.com/graalvm/mandrel/actions/runs/6217134691/job/16872546145#step:12:961
Steps to reproduce the issue
I have tried creating a minimal reproducer with no luck. One can reproduce this using Quarkus with the following commands:
git clone https://github.com/quarkusio/quarkus.git
cd quarkus
export GRAALVM_HOME=/path/to/latest/graalvm/build
./mvnw install -Dquickly -T4
./mvnw -Dnative -pl integration-tests/hibernate-orm-tenancy/datasource -Dnative.surefire.skip -Dformat.skip -Dno-descriptor-tests -Dlog.level=ALL clean package -Dquarkus.native.container-build=false
Describe GraalVM and your environment:
- GraalVM version (latest snapshot builds can be found here), or commit id if built from source: 764fc7e
- JDK major version: 21+35
- OS: Fedora 38
- Architecture: AMD64
More details
The issue was introduced by 1ed2a58 in #7436. Specifically this change.
diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/HostedSnippetReflectionProvider.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/HostedSnippetReflectionProvider.java
index 38985da7ca2..f14e3022456 100644
--- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/HostedSnippetReflectionProvider.java
+++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/HostedSnippetReflectionProvider.java
@@ -60,7 +60,8 @@ public class HostedSnippetReflectionProvider extends SubstrateSnippetReflectionP
}
AnalysisConstantReflectionProvider.validateRawObjectConstant(object);
/* Redirect constant lookup through the shadow heap. */
- return heapScanner.createImageHeapConstant(super.forObject(object), OtherReason.UNKNOWN);
+ return super.forObject(object);
+// return heapScanner.createImageHeapConstant(super.forObject(object), OtherReason.UNKNOWN);
}
@OverrideMakes the test pass, but is clearly not the solution.
Furthermore, 590890d breaks "Parsing context" in error reporting?
Before that commit the error looks like:
Error: Discovered unresolved type during parsing: org.apache.commons.logging.LogFactory. This error is reported at image build time because class org.flywaydb.core.internal.logging.apachecommons.ApacheCommonsLogCreator is registered for linking at image build time by command line and command line.
Error encountered while parsing org.flywaydb.core.internal.logging.apachecommons.ApacheCommonsLogCreator.createLogger(ApacheCommonsLogCreator.java:24)
Parsing context:
at org.flywaydb.core.internal.logging.multi.MultiLogCreator.createLogger(MultiLogCreator.java:34)
at org.flywaydb.core.api.logging.LogFactory.getLog(LogFactory.java:89)
at org.flywaydb.core.internal.logging.EvolvingLog.updateLog(EvolvingLog.java:31)
at org.flywaydb.core.internal.logging.EvolvingLog.debug(EvolvingLog.java:51)
at org.flywaydb.core.FlywayExecutor.showMemoryUsage(FlywayExecutor.java:335)
at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:226)
at io.quarkus.flyway.runtime.FlywayRecorder.doStartActions(FlywayRecorder.java:114)
at io.quarkus.deployment.steps.FlywayProcessor$startActions2035800939.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.FlywayProcessor$startActions2035800939.deploy(Unknown Source)
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
at com.oracle.svm.core.JavaMainWrapper.runCore0(JavaMainWrapper.java:233)
at com.oracle.svm.core.JavaMainWrapper.doRun(JavaMainWrapper.java:289)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
at static root method.(Unknown Source)
While after it, it is just:
Error: Discovered unresolved type during parsing: org.apache.commons.logging.LogFactory. This error is reported at image build time because class org.flywaydb.core.internal.logging.apachecommons.ApacheCommonsLogCreator is registered for linking at image build time by command line and command line.
Error encountered while parsing org.flywaydb.core.internal.logging.apachecommons.ApacheCommonsLogCreator.createLogger(ApacheCommonsLogCreator.java:24)
Parsing context:
at static root method.(Unknown Source)
@cstancu do you have any idea what might be causing this? My guess is that after #7436 the analysis fails to see the constant value of logger in https://github.com/flyway/flyway/blob/bc8a10ec4f50ca5a803c61bc255a94b8151f767d/flyway-core/src/main/java/org/flywaydb/core/api/logging/LogFactory.java#L93-L115 resulting in GraalVM trying to resolve classes not present on the classpath.