[
https://issues.apache.org/jira/browse/NIFI-5085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16440074#comment-16440074
]
Joseph Percivall commented on NIFI-5085:
----------------------------------------
Was curious why I didn't do this in the first place, turns out "closeable"
wasn't added to the response until after I refactored it[1]. Not sure when the
requirement for always closing it was added though. At the very least, the try
with resources should've been added in NIFI-2162 when we updated to OkHttp 3.x.
[1]
https://github.com/square/okhttp/commit/3699d5c9fd0ad78fc52e3ea317951f9d485f656f
> InvokeHttp does not close the response in all cases
> ---------------------------------------------------
>
> Key: NIFI-5085
> URL: https://issues.apache.org/jira/browse/NIFI-5085
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 1.0.0, 0.4.0, 0.5.0, 0.6.0, 0.4.1, 0.5.1, 0.7.0, 0.6.1,
> 1.1.0, 0.7.1, 1.2.0, 1.1.1, 1.0.1, 1.3.0, 1.4.0, 0.7.4, 1.5.0, 1.6.0
> Reporter: Joseph Percivall
> Assignee: Joseph Percivall
> Priority: Major
>
> As stated in this github issue for OkHttp[1] (the library InvokeHttp uses),
> the response needs to be closed for every instance of the response.
> InvokeHttp currently only closes the underlying body stream in the instance
> of there existing a body[2][3]. The proper way to do it is how the
> HttpNotificationService does, utilizing a try with resources on the
> response[4].
>
> I ran into this issue when my 1.5.0 instance hit OOM errors multiple times.
> I'm still not a 100% sure this is the root cause but one common thing between
> those OOM errors is repeated socket timeout exceptions in InvokeHttp (and
> even if it's not, it should still be fixed).
>
> [1] https://github.com/square/okhttp/issues/2311
> [2]
> https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java#L822
>
> [3]
> https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java#L894
>
> [4]
> https://github.com/apache/nifi/blob/master/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/notification/http/HttpNotificationService.java#L230
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)