You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by "Yossi Tamari (JIRA)" <ji...@apache.org> on 2018/07/23 15:36:00 UTC

[jira] [Commented] (NUTCH-2624) protocol-okhttp resource leak

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

Yossi Tamari commented on NUTCH-2624:
-------------------------------------

Hi [~wastl-nagel], I suspect it's the response body that needs closing here, and I would suggest using
{code:java}
try (ResponseBody responseBody = response.body()) {
  content = toByteArray(responseB...
}{code}
Instead of re-throwing the exception.

> 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)