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

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

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



##########
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:
       sorry, I misunderstood where you inserted these lines, when I viewed the 
limited diff of 'new changes' a moment ago.  my comment may not make sense.... 
let me revise:
   
   now seems you're doing the same RTTI check in two places.  if it passes the 
first time, you register w/ the `Closer` that's used here.  otherwise you 
follow up on the negation of the same check to take action here.  that does 
handle both run-time paths I was concerned about (modulo the connections not 
yet 'idle').
   
   1. are we concerned about non-idle connections?
   2. I have slight preference for wrapping in a `Closer` impl (as described in 
prior comment) which does the RTTI once--not for efficiency, but to encapsulate 
in a singular place.  your choice.




-- 
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: 748700)
    Time Spent: 3h 20m  (was: 3h 10m)

> 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 20m
>  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