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

Fix GraalVM native image build error #9593

Merged
merged 1 commit into from Sep 23, 2019
Merged

Conversation

pete-woods
Copy link
Contributor

@pete-woods pete-woods commented Sep 22, 2019

Motivation:

Error: Class that is marked for delaying initialization to run time got initialized during image building: io.netty.handler.codec.http2.Http2CodecUtil. Try marking this class for build-time initialization with --initialize-at-build-time=io.netty.handler.codec.http2.Http2CodecUtil
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1

Modification:

After debugging, it seems the culprit is io.netty.handler.codec.http2.Http2ClientUpgradeCodec, which also needs runtime initialisation.

Result:

Fixes #micronaut-projects/micronaut-grpc#8

See micronaut-projects/micronaut-grpc#8:
```
Error: Class that is marked for delaying initialization to run time got initialized during image building: io.netty.handler.codec.http2.Http2CodecUtil. Try marking this class for build-time initialization with --initialize-at-build-time=io.netty.handler.codec.http2.Http2CodecUtil
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1
```

After debugging, it seems the culprit is `io.netty.handler.codec.http2.Http2ClientUpgradeCodec`, which also needs runtime initialisation.
@netty-bot
Copy link

Can one of the admins verify this patch?

@normanmaurer
Copy link
Member

@vjovanov @pmlopes can you verify ?

@normanmaurer
Copy link
Member

@netty-bot test this please

auke- added a commit to auke-/micronaut-grpc-graal that referenced this pull request Sep 23, 2019
@pmlopes
Copy link
Contributor

pmlopes commented Sep 23, 2019

I believe this fix is correct, from the offending class I can see:

static {
  UPGRADE_HEADERS = Collections.singletonList(Http2CodecUtil.HTTP_UPGRADE_SETTINGS_HEADER);
}

Which depends on a class that must be initialized at runtime Http2CodecUtil.

I'll let @vjovanov to analyse further as I believe he has more insights on how the compiler works.

@vjovanov
Copy link
Contributor

All looks good, thanks!

@normanmaurer normanmaurer added this to the 4.1.42.Final milestone Sep 23, 2019
@normanmaurer
Copy link
Member

@pete-woods can you please sign our ICLA and let me know once done:

https://netty.io/s/icla ?

@pete-woods
Copy link
Contributor Author

@pete-woods can you please sign our ICLA and let me know once done:

https://netty.io/s/icla ?

Done

@normanmaurer normanmaurer merged commit 92809db into netty:master Sep 23, 2019
@normanmaurer
Copy link
Member

@pete-woods thanks a lot

normanmaurer pushed a commit that referenced this pull request Sep 23, 2019
Motivation:

Error: Class that is marked for delaying initialization to run time got initialized during image building: io.netty.handler.codec.http2.Http2CodecUtil. Try marking this class for build-time initialization with --initialize-at-build-time=io.netty.handler.codec.http2.Http2CodecUtil
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1
Modification:

After debugging, it seems the culprit is io.netty.handler.codec.http2.Http2ClientUpgradeCodec, which also needs runtime initialisation.

Result:

Fixes #micronaut-projects/micronaut-grpc#8
@pete-woods pete-woods deleted the patch-1 branch September 23, 2019 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants