[
https://issues.apache.org/jira/browse/GOBBLIN-1616?focusedWorklogId=748668&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-748668
]
ASF GitHub Bot logged work on GOBBLIN-1616:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 28/Mar/22 14:48
Start Date: 28/Mar/22 14:48
Worklog Time Spent: 10m
Work Description: phet commented on a change in pull request #3486:
URL: https://github.com/apache/gobblin/pull/3486#discussion_r836509194
##########
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:
you could close only the idle ones here, now... but why not make a shim
impl of `Closeable` that you could wrap it in and register w/ the `Closer`?
then, later, when that `Closer.close()` is called, you could handle all the CM
cnxns, idle or not. the difference in that approach is both closing all
cnxns--but also that the time when doing the close would be later, such that
more idle cnxns should develop.
stepping back, the seriousness of whether 'enough' to log and close only
idle versus to be certain to close all CM cnxns would seem to come down to how
prevalent is our use of `non-Closeable` `HttpClient`s. strictly speaking
however it looks like a resource leak not to close all of them always, by some
point, even if the situation of missing to close some be rare. do you agree?
--
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: 748668)
Time Spent: 2h 50m (was: 2h 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: 2h 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)