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

Remove build time initialisation of user metadata for GraalVM #10634

Merged
merged 3 commits into from
Mar 22, 2024

Conversation

graemerocher
Copy link
Contributor

@graemerocher graemerocher commented Mar 21, 2024

Seems with strict image heap it is not safe to initialise anything that could represent user code. Previously we could get away with initialising our generated classes, but since this reference user classes the viral nature of build time init results in initialising user code.

This manifested in dev builds failing with an error on the LogLevel enum, I attempted to mark this is build time init but there are 2 problems with this:

  1. It means any user defined enum will need to be marked as build time init
  2. Once fixed I hit another problem with expression language expressions which also need to be build time initialised. These are again user defined and we cannot know what the are.

So unfortunately the only solution I see going forward is to completely remove the build time init or our generated metadata. This change does this and in local benchmarks does not seem to have a major impact on memory or startup, however does increase the image size by 2mb.

Fixes #10630

@graemerocher graemerocher changed the title Reproduce error with dev builds Remove build time initialisation of user metadata for GraalVM Mar 22, 2024
@graemerocher graemerocher added this to the 4.4.0 milestone Mar 22, 2024
Copy link

sonarcloud bot commented Mar 22, 2024

@sdelamo sdelamo merged commit b2259ca into 4.4.x Mar 22, 2024
28 checks passed
@sdelamo sdelamo deleted the issue-10630 branch March 22, 2024 14:10
@dstepanov
Copy link
Contributor

We have some issues with enums values when the class is not on the classpath, I was thinking we can replace enums instance values with string or do try-catch aproach like classes.

@sdelamo
Copy link
Contributor

sdelamo commented Mar 27, 2024

@dstepanov what enums where you thinking of?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4.4.x broken in certain cases on native image (with enums)
3 participants