swagger-api / swagger-api/swagger-codegen
Out of memory when running the swagger-codegen-maven-plugin
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
mvn clean install fails with OutOfMemory with the following stack trace
[DEBUG] Ref property, simple name: WSContentInformation
[DEBUG] Resolving example for property io.swagger.models.properties.IntegerProperty@d7e9e510...
[DEBUG] Resolving example for property io.swagger.models.properties.DateTimeProperty@8e13ddb...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35.036 s
[INFO] Finished at: 2021-01-28T02:27:46+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Java heap space -> [Help 1]
java.lang.OutOfMemoryError: Java heap space
at com.fasterxml.jackson.core.util.TextBuffer.carr (TextBuffer.java:778)
at com.fasterxml.jackson.core.util.TextBuffer.expand (TextBuffer.java:739)
at com.fasterxml.jackson.core.util.TextBuffer.append (TextBuffer.java:502)
at com.fasterxml.jackson.core.io.SegmentedStringWriter.write (SegmentedStringWriter.java:58)
at com.fasterxml.jackson.core.json.WriterBasedJsonGenerator._flushBuffer (WriterBasedJsonGenerator.java:1880)
at com.fasterxml.jackson.core.json.WriterBasedJsonGenerator.writeRaw (WriterBasedJsonGenerator.java:497)
at com.fasterxml.jackson.core.util.DefaultIndenter.writeIndentation (DefaultIndenter.java:91)
at com.fasterxml.jackson.core.util.DefaultPrettyPrinter.writeObjectEntrySeparator (DefaultPrettyPrinter.java:302)
at com.fasterxml.jackson.core.json.WriterBasedJsonGenerator._writePPFieldName (WriterBasedJsonGenerator.java:304)
at com.fasterxml.jackson.core.json.WriterBasedJsonGenerator._writeFieldName (WriterBasedJsonGenerator.java:145)
at com.fasterxml.jackson.core.json.WriterBasedJsonGenerator.writeFieldName (WriterBasedJsonGenerator.java:128)
at com.fasterxml.jackson.databind.ser.std.StdKeySerializers$StringKeySerializer.serialize (StdKeySerializers.java:230)
at com.fasterxml.jackson.databind.ser.std.StdKeySerializers$Dynamic.serialize (StdKeySerializers.java:199)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields (MapSerializer.java:610)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize (MapSerializer.java:536)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize (MapSerializer.java:30)
at com.fasterxml.jackson.databind.ser.std.ObjectArraySerializer.serializeContents (ObjectArraySerializer.java:256)
at com.fasterxml.jackson.databind.ser.std.ObjectArraySerializer.serialize (ObjectArraySerializer.java:216)
at com.fasterxml.jackson.databind.ser.std.ObjectArraySerializer.serialize (ObjectArraySerializer.java:26)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields (MapSerializer.java:633)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize (MapSerializer.java:536)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize (MapSerializer.java:30)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields (MapSerializer.java:633)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize (MapSerializer.java:536)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize (MapSerializer.java:30)
at com.fasterxml.jackson.databind.ser.std.ObjectArraySerializer.serializeContents (ObjectArraySerializer.java:256)
at com.fasterxml.jackson.databind.ser.std.ObjectArraySerializer.serialize (ObjectArraySerializer.java:216)
at com.fasterxml.jackson.databind.ser.std.ObjectArraySerializer.serialize (ObjectArraySerializer.java:26)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields (MapSerializer.java:633)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize (MapSerializer.java:536)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize (MapSerializer.java:30)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields (MapSerializer.java:633)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError
Swagger-codegen version
Version 2.3.1 of the plugin.
The issue is not present for version 2.2.3 of the plugin.
Swagger declaration file content or url
https://www.friscris.be/ws/api/516/swagger.json
Command line used for generation
mvn clean install
plugin config in pom.xml:
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>${swagger-codegen-maven-plugin-version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec> https://www.friscris.be/ws/api/516/swagger.json</inputSpec>
<language>java</language>
<!--<library>okhttp-gson</library>-->
<library>resttemplate</library>
<generateApis>true</generateApis>
<generateApiDocumentation>false</generateApiDocumentation>
<generateApiTests>false</generateApiTests>
<generateModels>true</generateModels>
<generateModelDocumentation>false</generateModelDocumentation>
<generateModelTests>false</generateModelTests>
<withXml>false</withXml>
<configOptions>
<dateLibrary>java8</dateLibrary>
<sourceFolder>swagger</sourceFolder>
</configOptions>
<output>target/generated-sources/swagger</output>
</configuration>
</execution>
</executions>
</plugin>
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
Reproduce the failure with the pom.xml plugin configuration, mvn clean install, and the linked swagger.json input. Start by tracing the generation path associated with the Jackson serialization stack trace and compare plugin versions 2.3.1 and 2.2.3. Done means the provided specification generates successfully without Java heap space exhaustion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100