-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Description
# https://github.com/pili-engineering/pili-sdk-java/blob/master/src/main/java/com/qiniu/pili/RPC.java
if (response.isSuccessful()) {
ResponseBody responseBody = response.body();
String responseString = responseBody.string();
if (responseBody != null)
responseBody.close();
return responseString;
} else {
throw new PiliException(response);
}
上述代码在远程未正常返回200时,执行throw new PiliException(response); 这句代码时无法释放引用,出现以下报错,在抛异常前调用response.close()即不会出现该问题.
2020-09-02 19:33:26.054 WARN 14216 --- [ ConnectionPool] okhttp3.OkHttpClient : A connection to http://pili.qiniuapi.com/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
2020-09-02 19:33:26.054 WARN 14216 --- [ ConnectionPool] okhttp3.OkHttpClient : A connection to http://pili.qiniuapi.com/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
Metadata
Metadata
Assignees
Labels
No labels