OpenAPITools / OpenAPITools/openapi-generator
[BUG][C#]Additional logging to debug OOM exception
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
openapi-generator version
2.7.0
OpenAPI declaration file content or url
https://gist.github.com/PeterVaccaITR/04c4d1875096acdca665b49edfa72c76.js
Generation Details
"swagger:gen:lp-api:mac": "set JAVA_OPTS=\"%JAVA_OPTS% -Dlog.level=debug -Dio.swagger.parser.util.RemoteUrl.trustAll=true -Dio.swagger.v3.parser.util.RemoteUrl.trustAll=true\" && npx @openapitools/openapi-generator-cli generate -i https://localhost:7176/v3/apis/il-inview/swagger/swagger.json --additional-properties=withInterfaces=true,modelPropertyNaming=original,withSeparateModelsAndApi=true,legacyDiscriminatorBehavior=false --skip-validate-spec --api-package lp-offering-api --model-package models -g typescript-axios -o ./src/swagger/lp-offering-api",
Steps to reproduce
Running the above results in a OOM heap space exception. I don't see any additional logging with the -Dlog.level=debug
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.base/java.util.Arrays.copyOfRange(Arrays.java:3822)
at java.base/java.lang.String.<init>(String.java:4531)
at java.base/java.lang.String.<init>(String.java:1487)
at java.base/java.lang.StringBuilder.toString(StringBuilder.java:453)
at com.fasterxml.jackson.core.util.TextBuffer.contentsAsString(TextBuffer.java:465)
at com.fasterxml.jackson.core.io.SegmentedStringWriter.getAndClear(SegmentedStringWriter.java:85)
at com.fasterxml.jackson.databind.ObjectWriter.writeValueAsString(ObjectWriter.java:1146)
at io.swagger.v3.core.util.Json.pretty(Json.java:24)
at org.openapitools.codegen.DefaultCodegen.fromModel(DefaultCodegen.java:2982)
at org.openapitools.codegen.DefaultCodegen.handleMethodResponse(DefaultCodegen.java:4271)
at org.openapitools.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:4435)
at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1189)
at org.openapitools.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:1115)
at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:586)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:949)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:487)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Related issues/PRs
Suggest a fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided generator command with the linked OpenAPI declaration and reading the stack trace through DefaultCodegen.fromModel, DefaultCodegen.handleMethodResponse, and DefaultGenerator.processOperation. Check how the requested -Dlog.level=debug setting is handled during this OOM path. Done means the reproduction provides useful additional debug logging instead of only the heap-space exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100