[ 
https://issues.apache.org/jira/browse/GOBBLIN-1616?focusedWorklogId=748775&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-748775
 ]

ASF GitHub Bot logged work on GOBBLIN-1616:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Mar/22 17:00
            Start Date: 28/Mar/22 17:00
    Worklog Time Spent: 10m 
      Work Description: phet commented on a change in pull request #3486:
URL: https://github.com/apache/gobblin/pull/3486#discussion_r836651407



##########
File path: 
gobblin-core/src/main/java/org/apache/gobblin/source/extractor/extract/restapi/RestApiConnector.java
##########
@@ -84,6 +85,10 @@ public RestApiConnector(State state) {
   public void close() throws IOException {
     // This is to close any idle connections opening by the httpClient
     this.closer.close();
+    if (this.getHttpClient() != null && !(this.getHttpClient() instanceof 
Closeable)) {
+      log.warn("httpClient is not closable, we will only close the idle 
connections");
+      this.getHttpClient().getConnectionManager().closeIdleConnections(0, 
TimeUnit.MILLISECONDS);

Review comment:
       I see.  I'm not super familar with best practices for non-closeable 
clients, and so presumed the way to safely handle all resources would be 
`ClientConnectionManager.shutdown()`.  that is what my recommendation was based 
on.  but if that's not the way to full resource correctness, then definitely 
seems to be a gap in our ability to fully account for resources... and I 
wouldn't have any suggestions beyond what you have here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 748775)
    Time Spent: 3h 50m  (was: 3h 40m)

> Make RestApiConnector be able to close the connection finally
> -------------------------------------------------------------
>
>                 Key: GOBBLIN-1616
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1616
>             Project: Apache Gobblin
>          Issue Type: Bug
>            Reporter: Zihan Li
>            Priority: Major
>          Time Spent: 3h 50m
>  Remaining Estimate: 0h
>
> In RestApiConnector, we only consume the HttpEntity but not close the 
> response, which potentially leave the socket as CLOSE_WAIT status and eat up 
> the resources. 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to