Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply sun.nio.ch.Iocp substitutions only against Windows #7636

Merged
merged 1 commit into from
Mar 6, 2020
Merged

Apply sun.nio.ch.Iocp substitutions only against Windows #7636

merged 1 commit into from
Mar 6, 2020

Conversation

jaikiran
Copy link
Member

@jaikiran jaikiran commented Mar 6, 2020

Fixes #7632

The commit here applies the sun.nio.ch.Iocp @Substitution only on Windows to prevent issues noted in that linked bug.
With this change, the failure that I could reproduce from the original issue, on a non-Windows OS, no longer occurs and the project works fine.

I need one additional input from @gwenneg - in the original PR which introduced this Substitution, there's also a @Alias applied to sun.nio.ch.ThreadPool https://github.com/quarkusio/quarkus/pull/7587/files#diff-90406b62b00ac17517dec4fcf98458daR115. Now that class resides across different platforms, but do we want it enabled only when Windows in detected or is it fine to have it enabled on other OS, even when the other 2 Substitution/Alias now only apply for Windows?

@gsmet
Copy link
Member

gsmet commented Mar 6, 2020

I would apply the platform to the alias too if they are part of a consistent thing.

Copy link
Member

@rsvoboda rsvoboda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, reproducer app from #7632 works without problem with this fix

@cescoffier
Copy link
Member

cescoffier commented Mar 6, 2020

don't you need "sun.nio.ch.ThreadPool" too? Checking.

---> My own reply, no.

@cescoffier
Copy link
Member

No something is still not fixed:

Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: io.quarkus.runtime.ThreadPoolConfig$$accessor.set_prefill(java.lang.Object, boolean). To diagnose the issue you can use the --allow-incomplete-classpath option. The missing method is then reported at run time when it is accessed the first time.
Detailed message:
Trace: 
        at parsing io.quarkus.runtime.generated.Config.initGroup$io$quarkus$runtime$ThreadPoolConfig(Config.zig:306)
Call path from entry point to io.quarkus.runtime.generated.Config.initGroup$io$quarkus$runtime$ThreadPoolConfig(SmallRyeConfig, StringBuilder, Object): 
        at io.quarkus.runtime.generated.Config.initGroup$io$quarkus$runtime$ThreadPoolConfig(Config.zig:214)
        at io.quarkus.runtime.generated.Config.readConfig(Config.zig:46676)
        at io.quarkus.deployment.steps.RuntimeConfigSetup.deploy(RuntimeConfigSetup.zig:38)
        at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:103)
        at io.quarkus.runtime.Application.start(Application.java:90)
        at io.quarkus.runtime.Application.run(Application.java:228)
        at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:41)
        at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:151)
        at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
        at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)

com.oracle.svm.core.util.UserError$UserException: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: io.quarkus.runtime.ThreadPoolConfig$$accessor.set_prefill(java.lang.Object, boolean). To diagnose the issue you can use the --allow-incomplete-classpath option. The missing method is then reported at run time when it is accessed the first time.
Detailed message:
Trace: 
        at parsing io.quarkus.runtime.generated.Config.initGroup$io$quarkus$runtime$ThreadPoolConfig(Config.zig:306)
Call path from entry point to io.quarkus.runtime.generated.Config.initGroup$io$quarkus$runtime$ThreadPoolConfig(SmallRyeConfig, StringBuilder, Object): 
        at io.quarkus.runtime.generated.Config.initGroup$io$quarkus$runtime$ThreadPoolConfig(Config.zig:214)
        at io.quarkus.runtime.generated.Config.readConfig(Config.zig:46676)
        at io.quarkus.deployment.steps.RuntimeConfigSetup.deploy(RuntimeConfigSetup.zig:38)
        at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:103)
        at io.quarkus.runtime.Application.start(Application.java:90)
        at io.quarkus.runtime.Application.run(Application.java:228)
        at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:41)
        at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:151)
        at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
        at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)

        at com.oracle.svm.core.util.UserError.abort(UserError.java:75)
        at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:221)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:736)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:530)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: io.quarkus.runtime.ThreadPoolConfig$$accessor.set_prefill(java.lang.Object, boolean). To diagnose the issue you can use the --allow-incomplete-classpath option. The missing method is then reported at run time when it is accessed the first time.
Detailed message:
Trace: 
        at parsing io.quarkus.runtime.generated.Config.initGroup$io$quarkus$runtime$ThreadPoolConfig(Config.zig:306)
Call path from entry point to io.quarkus.runtime.generated.Config.initGroup$io$quarkus$runtime$ThreadPoolConfig(SmallRyeConfig, StringBuilder, Object): 
        at io.quarkus.runtime.generated.Config.initGroup$io$quarkus$runtime$ThreadPoolConfig(Config.zig:214)
        at io.quarkus.runtime.generated.Config.readConfig(Config.zig:46676)
        at io.quarkus.deployment.steps.RuntimeConfigSetup.deploy(RuntimeConfigSetup.zig:38)
        at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:103)
        at io.quarkus.runtime.Application.start(Application.java:90)
        at io.quarkus.runtime.Application.run(Application.java:228)
        at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:41)
        at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:151)
        at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
        at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)

        at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:733)
        ... 8 more
Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: io.quarkus.runtime.ThreadPoolConfig$$accessor.set_prefill(java.lang.Object, boolean). To diagnose the issue you can use the --allow-incomplete-classpath option. The missing method is then reported at run time when it is accessed the first time.
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:239)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedMethod(SharedGraphBuilderPhase.java:229)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedInvoke(SharedGraphBuilderPhase.java:183)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1576)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1551)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5170)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3286)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3093)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:977)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:871)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:197)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:221)
        at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:340)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:310)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:300)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:107)
        at com.oracle.graal.pointsto.flow.StaticInvokeTypeFlow.update(InvokeTypeFlow.java:346)
        at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:511)
        at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:171)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
        ... 5 more
Error: Image build request failed with exit status 1

@dmlloyd
Copy link
Member

dmlloyd commented Mar 6, 2020

CI passed. Are you sure your build is good? That stack looks like an out of date jar to me.

@cescoffier
Copy link
Member

Let me retry with a fresh master build

@gemmellr
Copy link
Contributor

gemmellr commented Mar 6, 2020

I built the PR branch and tested locally with GraalVM 19.3.1 and 20.0.0, both passed ok.

@cescoffier
Copy link
Member

Confirmed, works with a full build of quarkus.

@jaikiran
Copy link
Member Author

jaikiran commented Mar 6, 2020

I need one additional input from @gwenneg - in the original PR which introduced this Substitution, there's also a @alias applied to sun.nio.ch.ThreadPool https://github.com/quarkusio/quarkus/pull/7587/files#diff-90406b62b00ac17517dec4fcf98458daR115. Now that class resides across different platforms, but do we want it enabled only when Windows in detected or is it fine to have it enabled on other OS, even when the other 2 Substitution/Alias now only apply for Windows?

Thinking a bit more and from the inputs I've received so far:

I would apply the platform to the alias too if they are part of a consistent thing.

I think it makes sense to apply the @Platform(Windows) annotation on the Target_sun_nio_ch_ThreadPool too, since the original PR which introduced these aliases and substitutions were all part of one commit which all tried to address a Windows issue. So I've updated this PR to include Target_sun_nio_ch_ThreadPool in this change. Local (basic) tests have passed with this change.

@gemmellr
Copy link
Contributor

gemmellr commented Mar 6, 2020

I rebuilt the updated PR branch and tested locally again with GraalVM 19.3.1 and 20.0.0, worked fine as before.

@gsmet
Copy link
Member

gsmet commented Mar 6, 2020

I'm merging as current CI is mostly useless for that one. And I need it for an upcoming PR.

@gsmet gsmet merged commit ea79e16 into quarkusio:master Mar 6, 2020
@gsmet
Copy link
Member

gsmet commented Mar 6, 2020

Thanks @jaikiran !

@gsmet gsmet added this to the 1.4.0 milestone Mar 6, 2020
@jaikiran jaikiran deleted the qk-7632 branch March 6, 2020 13:59
@gwenneg
Copy link
Member

gwenneg commented Mar 6, 2020

Sorry, I had a very busy day and missed the whole discussion.

The fix looks good to me, thanks @jaikiran and everyone involved!

@gsmet gsmet modified the milestones: 1.4.0, 1.3.0.CR2 Mar 6, 2020
@gwenneg
Copy link
Member

gwenneg commented Mar 6, 2020

I need one additional input from @gwenneg - in the original PR which introduced this Substitution, there's also a @Alias applied to sun.nio.ch.ThreadPool https://github.com/quarkusio/quarkus/pull/7587/files#diff-90406b62b00ac17517dec4fcf98458daR115. Now that class resides across different platforms, but do we want it enabled only when Windows in detected or is it fine to have it enabled on other OS, even when the other 2 Substitution/Alias now only apply for Windows?

For the record, I introduced the sun.nio.ch.Iocp and sun.nio.ch.ThreadPool substitutions to gain access to constructors/methods that were package-protected and required to realize the sun.nio.ch.Iocp substition and runtime intialization. The entire commit was made to achieve that goal for the Windows platform only, so I should have used @Platforms({ Platform.WINDOWS.class }) from the beginning. Sorry about that oversight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants