Skip to content

Fix GraalVM native image build error#9593

Merged
normanmaurer merged 1 commit intonetty:masterfrom
pete-woods:patch-1
Sep 23, 2019
Merged

Fix GraalVM native image build error#9593
normanmaurer merged 1 commit intonetty:masterfrom
pete-woods:patch-1

Conversation

@pete-woods
Copy link
Copy Markdown
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
Copy Markdown

Can one of the admins verify this patch?

@normanmaurer
Copy link
Copy Markdown
Member

@vjovanov @pmlopes can you verify ?

@normanmaurer
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

All looks good, thanks!

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

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

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

@pete-woods
Copy link
Copy Markdown
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
Copy Markdown
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.

5 participants