Commit 5e55312
committed
fix(integrations): close AsyncDaytona client in DaytonaEnvironment.close()
DaytonaEnvironment.close() deleted the sandbox and then dropped the
AsyncDaytona client by setting self._client = None, without awaiting the
client's close(). That client owns the underlying aiohttp session plus
the REST and toolbox API clients, so discarding the reference leaked
sockets on every create/close cycle. The Daytona SDK documents that
AsyncDaytona.close() should be called to release those HTTP sessions and
avoid resource leaks (or the client used as an async context manager).
Await self._client.close() before clearing the reference. close() is
idempotent, so the existing double-close no-op behavior is preserved.
The unit test now gives the mock client an AsyncMock close() and asserts
DaytonaEnvironment.close() awaits it exactly once.1 parent e6df097 commit 5e55312
2 files changed
Lines changed: 9 additions & 0 deletions
File tree
- src/google/adk/integrations/daytona
- tests/unittests/integrations/daytona
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
99 | 103 | | |
100 | 104 | | |
101 | 105 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| 107 | + | |
106 | 108 | | |
107 | 109 | | |
| 110 | + | |
108 | 111 | | |
| 112 | + | |
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
112 | 116 | | |
113 | 117 | | |
| 118 | + | |
114 | 119 | | |
115 | 120 | | |
116 | 121 | | |
| |||
0 commit comments