OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
20.51k stars 6.27k forks source link

[BUG] Kotlin ApiClient leaks `okhttp3.Response`. #18996

Closed gosusnp closed 5 days ago

gosusnp commented 1 week ago

Bug Report Checklist

Description

We tracked down a memory leak from the generated api client in kotlin. The okhttp3.Response is closeable and isn't closed. This commit shows the fix we did on our end that addressed the leak.

openapi-generator version

We were using 0.6.2, we migrated to 7.6.0however, looking at the generated code, I believe the issue remains.

OpenAPI declaration file content or url
Generation Details
Steps to reproduce

Generate a kotlin client, keep on calling any requests, see memory usage keeps going up.

Related issues/PRs
Suggest a fix

Suggested fix: https://github.com/OpenAPITools/openapi-generator/pull/18997