[ 
https://issues.apache.org/jira/browse/NUTCH-2624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16553233#comment-16553233
 ] 

Sebastian Nagel commented on NUTCH-2624:
----------------------------------------

Yes, it's the ResponseBody which leaks, but from the docs of 
[okhttp3.Response|https://square.github.io/okhttp/3.x/okhttp/okhttp3/Response.html]:
 "This class implements Closeable. Closing it simply closes its response body." 
Yes, it's not about "rethrowing" but simply not catching the exception, with a 
try with resources on the Response as before 
[f598db7|https://github.com/apache/nutch/commit/f598db7] - and also driven by 
this [comment about leaking the ResponseBody without calling 
.body()|https://github.com/square/okhttp/issues/2311#issuecomment-179521327]. 
But agreed: your solution is smarter and avoids a lot of extra indentations. 
I'll dig deeper into the implementation whether it'll work. Thanks!

> protocol-okhttp resource leak
> -----------------------------
>
>                 Key: NUTCH-2624
>                 URL: https://issues.apache.org/jira/browse/NUTCH-2624
>             Project: Nutch
>          Issue Type: Bug
>          Components: protocol
>    Affects Versions: 1.15
>            Reporter: Sebastian Nagel
>            Priority: Major
>             Fix For: 1.15
>
>
> The protocol-okhttp leaks response streams as logged by 
> okhttp3.ConnectionPool:
> {noformat}
> WARNING: A connection to ... was leaked. Did you forget to close a response 
> body?
> {noformat}
> This has been introduced in commit 
> [f598db7|https://github.com/apache/nutch/commit/f598db7] - need to catch the 
> IOException *and* close the response, then re-throw so that FetcherThread can 
> handle the exception.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to