swagger-api/swagger-codegen

[JAVA] Code generated has memory leak within Okhttp/Okio

Open

#5372 aperta il 12 apr 2017

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)HTML (5474 fork)batch import
Client: JavaIssue: Bughelp wanted

Metriche repository

Star
 (12.701 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor