Skip to content

Commit

Permalink
Set enable_cleanup_closed=True to drop TLS connections without a shut…
Browse files Browse the repository at this point in the history
…down (#468)

* Set enable_cleanup_closed=True to drop TLS connections without a shutdown

AsyncOpenSearch seems to leak TLS connections due to a missing parameter in `aiohttp.TCPConnector`. This causes #172 and was also fixed "upstream" in this issue elastic/elasticsearch-py#1910. 

Signed-off-by: Sandor Nemes <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Sandor Nemes <[email protected]>

---------

Signed-off-by: Sandor Nemes <[email protected]>
Signed-off-by: Daniel (dB.) Doubrovkine <[email protected]>
Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
  • Loading branch information
snemes and dblock authored Nov 9, 2023
1 parent 56c96d7 commit 56606ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Use API generator for all APIs ([#551](https://github.com/opensearch-project/opensearch-py/pull/551))
- Merge `.pyi` type stubs inline ([#563](https://github.com/opensearch-project/opensearch-py/pull/563))
- Expanded type coverage to benchmarks, samples and tests ([#566](https://github.com/opensearch-project/opensearch-py/pull/566))
- Defaulted `enable_cleanup_closed=True` in `aiohttp.TCPConnector` to prevent TLS connection leaks ([#468](https://github.com/opensearch-project/opensearch-py/pull/468))
### Deprecated
- Deprecated point-in-time APIs (list_all_point_in_time, create_point_in_time, delete_point_in_time) and Security Client APIs (health_check and update_audit_config) ([#502](https://github.com/opensearch-project/opensearch-py/pull/502))
### Removed
Expand Down Expand Up @@ -162,4 +163,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
[2.2.0]: https://github.com/opensearch-project/opensearch-py/compare/v2.1.1...v2.2.0
[2.3.0]: https://github.com/opensearch-project/opensearch-py/compare/v2.2.0...v2.3.0
[2.3.1]: https://github.com/opensearch-project/opensearch-py/compare/v2.3.0...v2.3.1
[2.3.2]: https://github.com/opensearch-project/opensearch-py/compare/v2.3.1...v2.3.2
[2.3.2]: https://github.com/opensearch-project/opensearch-py/compare/v2.3.1...v2.3.2
5 changes: 4 additions & 1 deletion opensearchpy/_async/http_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,10 @@ async def _create_aiohttp_session(self) -> Any:
cookie_jar=aiohttp.DummyCookieJar(),
response_class=OpenSearchClientResponse,
connector=aiohttp.TCPConnector(
limit=self._limit, use_dns_cache=True, ssl=self._ssl_context
limit=self._limit,
use_dns_cache=True,
enable_cleanup_closed=True,
ssl=self._ssl_context,
),
trust_env=self._trust_env,
)
Expand Down

0 comments on commit 56606ed

Please sign in to comment.