Details
-
Bug
-
Resolution: Done
-
Minor
-
12.0.0.Dev07
-
None
Description
RestClient needs responses with bodies to be closed, either explicitly, or implicitly by reading the entire body. CacheV2ResourceTest checks only the HTTP status for most responses, without reading the body.
OkHttpClient logs a WARN message when a response is not closed. If debug logging is enabled for okhttp3.OkHttpClient, the message includes a stack trace:
10:22:36,569 WARN (OkHttp ConnectionPool) [OkHttpClient] A connection to https://localhost:43483/ was leaked. Did you forget to close a response body? java.lang.Throwable: response.body().close() at okhttp3.internal.platform.Platform.getStackTraceForCloseable(Platform.java:149) at okhttp3.internal.connection.Transmitter.callStart(Transmitter.java:116) at okhttp3.RealCall.enqueue(RealCall.java:92) at org.infinispan.client.rest.impl.okhttp.RestClientOkHttp.execute(RestClientOkHttp.java:248) at org.infinispan.client.rest.impl.okhttp.RestCacheClientOkHttp.post(RestCacheClientOkHttp.java:94) at org.infinispan.rest.resources.CacheV2ResourceTest.testCacheV2KeyOps(CacheV2ResourceTest.java:142)