You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/02/28 08:33:34 UTC
[buildstream] 04/04: sandbox/_sandboxremote.py: Close the storage remote at cleanup time
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch tristan/fix-leaking-grpc-threads
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 02f6a13de7a28d742302de09296701a687052d49
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Mon Feb 28 17:29:10 2022 +0900
sandbox/_sandboxremote.py: Close the storage remote at cleanup time
Fixes #1582
---
src/buildstream/sandbox/_sandboxremote.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/buildstream/sandbox/_sandboxremote.py b/src/buildstream/sandbox/_sandboxremote.py
index 2f2344e..4c0a86b 100644
--- a/src/buildstream/sandbox/_sandboxremote.py
+++ b/src/buildstream/sandbox/_sandboxremote.py
@@ -53,6 +53,7 @@ class SandboxRemote(SandboxREAPI):
self.operation_name = None
if self.storage_spec:
+ self.own_storage_remote = True
self.storage_remote = CASRemote(self.storage_spec, cascache)
try:
self.storage_remote.init()
@@ -61,6 +62,7 @@ class SandboxRemote(SandboxREAPI):
"Failed to contact remote execution CAS endpoint at {}: {}".format(self.storage_spec.url, e)
) from e
else:
+ self.own_storage_remote = False
self.storage_remote = cascache.get_default_remote()
def run_remote_command(self, channel, action_digest):
@@ -288,3 +290,7 @@ class SandboxRemote(SandboxREAPI):
raise SandboxError("Remote server failed at executing the build request.")
return execution_response.result
+
+ def _cleanup(self):
+ if self.own_storage_remote:
+ self.storage_remote.close()