OpenAPITools / OpenAPITools/openapi-generator

[BUG][C#]Additional logging to debug OOM exception

Open
#16,347 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.