-
-
Notifications
You must be signed in to change notification settings - Fork 523
ClassGraph raised OOM error in my project #2050
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
Comments
I tried to add global A question here, by default I have disabled spring doc( |
Today I tried to add |
I wonder why ClassGraph is scanning class infos in the background even I disable springdoc. |
This is |
@bnasslahsen It seems you did not read all of my messages. I have discussed with the ClassGraph guys firstly, they confirmed it is related to the project and how to use it. So I created an issue here. I extracted the explanation from the ClassGraph guys.
Obviously, I disabled springdoc in application.properties, the ClassGraph still scans at every Spring context setup phase in the tests. This is unreasonable. And setup scan scopes in every grouped OpenAPI beans, it also does not stop the OOM. If the GroupedOpenApi.builder()
.group("myGroup")
.pathsToMatch(*paths)
.packagesToScan("com.example")
... |
I invite you to check deeper. Try just référencing the swagger-core and swagger-ui directly to confirm the root library cause of your error. |
So it can be removed? But from the project dependency tree, spring doc depends on it directly. |
Classgraph is required by This dependency is only required for the UI to hide the UI version from the URL. Basically, if you don't reference the SWAGGER-UI, it will not be added. You will see in the URL, the version of the swagger-ui. If you are still having issues, you will need to Provide a Minimal, Reproducible Example - with HelloController that reproduces the problem |
Of course I would like provide a small example project to produce the errors, but I found it is only occurred when there are a bundle of classes existed in the project. I noticed there is a PR to review webjar-locator-core #2173, hope it resolve my issue. |
You can try with the latest SNAPSHOT and provide your feedback. |
My project is based on Spring Boot 3/R2dbc + Kotlin/KotlinCoroutines + Java 17(set Language Level to 17). I am using the latest 2.0.2 in my project.
The source codes archived 100k lines now.
In the newest feature branch, I always encountered an OutOfMemoery error when running tests on Github Actions, even I used a custom larger runner with 4 core + 16G and increased the Gralde jvm args to use a larger heap size(4G, 8G, 12G) to build the project. It is 100% failed due to the OOM error.
There is a question I posted on StackOverFlow, https://stackoverflow.com/questions/75169922/outofmemoryerror-in-gradle-springboot-kotlin-coroutines-project
Today I tried to remove Spring Doc config, and spring-doc dep, it works. And the build progress is shorten to 75%, and saved 2 min.
I am not sure why if ClassGraph is a must for springdoc, Spring itself scan all beans at runtime. Why we need another scanner in the background and finally kill the application.
The text was updated successfully, but these errors were encountered: