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

Aot generated sources fail to compile with 'File name too long' error #29846

Closed
adisesha opened this issue Jan 18, 2023 · 7 comments
Closed

Aot generated sources fail to compile with 'File name too long' error #29846

adisesha opened this issue Jan 18, 2023 · 7 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@adisesha
Copy link

adisesha commented Jan 18, 2023

Steps to reproduce:

  1. Go to start.spring
  2. Project: Gradle-Kotlin
  3. Language: Kotlin
  4. Spring Boot: 3.0.1
  5. Packaging: Jar
  6. Java: 17
  7. Dependencies: GraalVM Native Support, Spring Boot Actuator
  8. Generate the project(attached generated project for convenience) and run ./gradlew nativeRun. I got the following error,
> Task :compileAotJava FAILED
/home/test/Downloads/actuator-bug/build/generated/aotSources/org/springframework/boot/actuate/autoconfigure/observation/ObservationAutoConfiguration__BeanDefinitions.java:115: error: error while writing OnlyMetricsMeterObservationHandlerConfiguration__BeanDefinitions: /home/test/Downloads/actuator-bug/build/classes/java/aot/org/springframework/boot/actuate/autoconfigure/observation/ObservationAutoConfiguration__BeanDefinitions$MeterObservationHandlerConfiguration__BeanDefinitions$OnlyMetricsMeterObservationHandlerConfiguration__BeanDefinitions.class: File name too long
    public static class OnlyMetricsMeterObservationHandlerConfiguration__BeanDefinitions {

Environment:

  • Ubuntu 22.04.1 LTS
  • openjdk 17.0.5 2022-10-18
  • OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08)
  • OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08, mixed mode, sharing)

actuator-bug.zip

@adisesha adisesha changed the title Aot generated sources fail to compile with 'File name too long' too long error Aot generated sources fail to compile with 'File name too long' terror Jan 18, 2023
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 18, 2023
@mhalbritter
Copy link
Contributor

Hm, I can't reproduce this. What's the filesystem of /home/test/Downloads?

@mhalbritter
Copy link
Contributor

mhalbritter commented Jan 18, 2023

/home/test/Downloads/actuator-bug/build/classes/java/aot/org/springframework/boot/actuate/autoconfigure/observation/ObservationAutoConfiguration__BeanDefinitions$MeterObservationHandlerConfiguration__BeanDefinitions$OnlyMetricsMeterObservationHandlerConfiguration__BeanDefinitions.class is 286 chars long. The filename ObservationAutoConfiguration__BeanDefinitions$MeterObservationHandlerConfiguration__BeanDefinitions$OnlyMetricsMeterObservationHandlerConfiguration__BeanDefinitions.class is 170 chars long.

On my system (Fedora with BTRFS file system) the limits are:

$ getconf PATH_MAX ~
4096

$ getconf NAME_MAX ~
255

@mhalbritter mhalbritter added the status: waiting-for-feedback We need additional information before we can continue label Jan 18, 2023
@adisesha
Copy link
Author

adisesha commented Jan 18, 2023

The file system is ecryptfs

Results of getconf commands,

$ getconf PATH_MAX ~
4096

$ getconf NAME_MAX ~
143

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jan 18, 2023
@mhalbritter
Copy link
Contributor

Well, that explains it. Not sure if we can do something here. I'll flag it as team attention to see what the team thinks.

@mhalbritter mhalbritter changed the title Aot generated sources fail to compile with 'File name too long' terror Aot generated sources fail to compile with 'File name too long' error Jan 18, 2023
@bclozel bclozel transferred this issue from spring-projects/spring-boot Jan 18, 2023
@philwebb
Copy link
Member

Suggestion from @wilkinsona would be to remove __BeanDefinitions for nested classes. E.g

ObservationAutoConfiguration__BeanDefinitions$MeterObservationHandlerConfiguration__BeanDefinitions$OnlyMetricsMeterObservationHandlerConfiguration__BeanDefinitions.class

Becomes

ObservationAutoConfiguration__BeanDefinitions$MeterObservationHandlerConfiguration$OnlyMetricsMeterObservationHandlerConfiguration.class

@sdeleuze sdeleuze added the theme: aot An issue related to Ahead-of-time processing label Jan 19, 2023
@sdeleuze sdeleuze self-assigned this Jan 20, 2023
@sbrannen sbrannen added the in: core Issues in core modules (aop, beans, core, context, expression) label Jan 31, 2023
@snicoll snicoll assigned snicoll and unassigned sdeleuze Apr 26, 2023
@snicoll snicoll added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Apr 26, 2023
@snicoll snicoll modified the milestones: 6.0.x, 6.0.9 Apr 26, 2023
@snicoll
Copy link
Member

snicoll commented Apr 26, 2023

Thanks for the suggestion. It turned out to be quite straightforward to change and a good thing regardless of this issue.

@adisesha the generated class names will be shorter, I hope it'll be enough for your env. Please give it a try and let us know if more optimizations are required. Thanks!

@adisesha
Copy link
Author

adisesha commented Apr 27, 2023

@snicoll Thank you. It works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

8 participants