Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple connection/socket leaks #279

Merged
merged 2 commits into from
Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions enterprise_gateway/services/processproxies/processproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,11 @@ def _update_connection(self, connect_info):
else:
raise RuntimeError("RemoteProcessProxy.update_connection: connection information is null!")

if self.response_socket:
self.response_socket.shutdown(SHUT_RDWR)
self.response_socket.close()
self.response_socket = None

self.kernel_manager._connection_file_written = True # allows for cleanup of local files (as necessary)

def _extract_comm_port(self, connect_info):
Expand Down Expand Up @@ -696,6 +701,7 @@ def shutdown_listener(self):
"(using remote kill): {}".format(self.comm_ip, self.comm_port,
self.kernel_id, str(e)))
finally:
sock.shutdown(SHUT_WR)
sock.close()

# Also terminate the tunnel process for the communication port - if in play. Failure to terminate
Expand Down
4 changes: 4 additions & 0 deletions enterprise_gateway/services/processproxies/yarn.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ def query_app_by_name(self, kernel_id):
except Exception as e:
self.log.warning("Query for kernel ID '{}' failed with exception: {} - '{}'. Continuing...".
format(kernel_id, type(e), e))
finally:
self.resource_mgr.http_conn.close()

if type(data) is dict and type(data.get("apps")) is dict and 'app' in data.get("apps"):
for app in data['apps']['app']:
Expand All @@ -282,6 +284,8 @@ def query_app_by_id(self, app_id):
except Exception as e:
self.log.warning("Query for application ID '{}' failed with exception: '{}'. Continuing...".
format(app_id, e))
finally:
self.resource_mgr.http_conn.close()
if type(data) is dict and 'app' in data:
return data['app']
return None
Expand Down