swagger-api / swagger-api/swagger-codegen
[JAVA] Code generated has memory leak within Okhttp/Okio
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
After running the code generator and deploying into Tomcat 7.0.54 and JDK 1.7.55, deploying and un-deploying the WAR packages causes Tomcat to report that there is a memory leak within Okio and the below log appears in Tomcat:
"SEVERE: The web application [/XXXXXX] appears to have started a thread named [Okio Watchdog] but has failed to stop it. This is very likely to create a memory leak."
Swagger-codegen version
Latest version
Command line used for generation
Sample below causes the issue
https://github.com/swagger-api/swagger-codegen/blob/master/bin/windows/java-petstore-okhttp-gson.bat
Steps to reproduce
1: Run code generator
2: Build WAR
3: Deploy to Tomcat server
4: Use website
5: Un-deploy
Suggest a Fix
A fix for this was reported within https://github.com/square/okio/pull/256 for the latest version of Okio this supports terminating the daemon threads after 60 seconds.
Manually updating the library and overriding the Okio library v1.6.0 with v1.11.0 after running swagger-codegen fixes the issue.
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 with the sample generator command in bin/windows/java-petstore-okhttp-gson.bat and review the generated WAR's Okio dependency against the reported 1.6.0 and 1.11.0 versions. Reproduce the deploy and undeploy sequence in Tomcat, then verify that the Okio Watchdog warning no longer appears.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100