Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

Remove -H:+AllowIncompleteClasspath and --report-unsupported-elements-at-runtime #141

Closed
ppalaga opened this issue Jun 1, 2021 · 12 comments
Assignees
Labels
bug Something isn't working P2

Comments

@ppalaga
Copy link

ppalaga commented Jun 1, 2021

These are options suitable for debugging but nor for running production code. For --report-unsupported-elements-at-runtime, see e.g. oracle/graal#1725 (comment)

Related apache/camel-quarkus#2692 , quarkiverse/quarkus-google-cloud-services#119

@loicmathieu
Copy link

@dzou can you have a look at this one ?

We discover this flag being set on the library while investiguating a graalvm native issue on recent version of Netty (due to Brotli compresson), and it's bad practice as this is a debugging flag that should be used at client side not at library side.

@elefeint
Copy link
Contributor

elefeint commented Jun 1, 2021

@ppalaga Thanks for catching this! We'll remove the development properties.

@dzou
Copy link
Contributor

dzou commented Jun 3, 2021

Thanks for reporting this, I will try to resolve this.

Unfortunately we are blocked on fixing this immediately due to an issue in the grpc-netty-shaded dependency (See: grpc/grpc-java#7540). Basically this dependency does not shade the native-image config inherited from netty correctly and the compiler will not recognize the classes referenced. This is why we had to add --report-unsupported-elements-at-runtime originally.

I'll try to contribute the fix upstream and see if we can resolve this.

@dzou
Copy link
Contributor

dzou commented Jul 21, 2021

Just an update, finally got around to fixing this.

We were able to submit a patch in grpc/grpc-java#8258 upstream, waited for a new release, and #167 will fully remove the flags.

@loicmathieu
Copy link

@dzou great, thanks for the heads up

@ppalaga
Copy link
Author

ppalaga commented Jul 22, 2021

Perfect, thanks!

@dzou
Copy link
Contributor

dzou commented Jul 26, 2021

@loicmathieu @ppalaga -- Sorry guys, I was a little early in my excitement reporting the news. I was actually only able to remove --report-unsupported-elements-at-runtime however unable to remove allow-incomplete-classpath.

I'm basically hitting this class of error and not sure how to solve it without --allow-incomplete-classpath.

Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException:
Discovered unresolved method during parsing: io.grpc.netty.shaded.io.netty.handler.ssl.JettyAlpnSslEngine$ClientEngine.<init>(javax.net.ssl.SSLEngine, io.grpc.netty.shaded.io.netty.handler.ssl.JdkApplicationProtocolNegotiator).
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.

I've studied Quarkus's solution for netty which might be similar to what we wish to do. But we don't have the resources for our project to maintain a set of complex GraalVM substitutions; so I'm unable to move in that direction if that is what it takes. But curious to hear if you may know what we could try.

@ppalaga
Copy link
Author

ppalaga commented Jul 27, 2021

@dzou hard to say how much the class JettyAlpnSslEngine$ClientEngine that refers to unavailable methods is wired to the rest of your artifacts. If it is actually not necessary, you may try to remove it (and its dependents) from the grpc-netty-shaded artifact (using Maven Shade plugin or which ever other tool you use to produce grpc-netty-shaded).

@ppalaga
Copy link
Author

ppalaga commented Jul 27, 2021

If removing is too complicated (and if the stuff done in io.grpc.netty.shaded.io.netty.handler.ssl.JettyAlpnSslEngine$ClientEngine.<init>(javax.net.ssl.SSLEngine, io.grpc.netty.shaded.io.netty.handler.ssl.JdkApplicationProtocolNegotiator) is not required) you could try to replace the ClientEngine.<init>(javax.net.ssl.SSLEngine, io.grpc.netty.shaded.io.netty.handler.ssl.JdkApplicationProtocolNegotiator) constructor with an empty stub.

@dzou
Copy link
Contributor

dzou commented Aug 4, 2021

Gotcha, thanks for the tips. Will give it another attempt.

@dzou
Copy link
Contributor

dzou commented Aug 13, 2021

Hey I revisited this, and we were able to successfully remove --report-unsupported-elements-at-runtime in #167

I tried for a few hours to remove -H:+AllowIncompleteClasspath but I wasn't successful and still ended up requiring a lot of substitution classes. I could try further, but long term I don't think we have the ability to maintain a large set of substitutions as underlying code changes. I'm planning on just keeping -H:+AllowIncompleteClasspath for now.

But I think --report-unsupported-elements-at-runtime is the main culprit in all of this, hopefully removing this is most of the problem. I will close this issue for now since we don't plan on pursuing this further, but let me know if new problems with --allow-incomplete-classpath emerge.

@dzou dzou closed this as completed Aug 13, 2021
@loicmathieu
Copy link

Thanks, we'll see how it goes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working P2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants