Skip to content
Commit 3eb14542 authored by Kevin Kirsche's avatar Kevin Kirsche Committed by Bjorn Neergaard
Browse files

fix: "ResourceWarning: unclosed SSLSocket"

Relates to: #2153
When running `poetry update`, during the download phase when `PYTHONWARNINGS="default"` environment variable is set, multiple different sessions trigger resource warnings. This fixes one of them that occurs during the download phase of the package update.

```
/Users/username/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:594: ResourceWarning: unclosed <ssl.SSLSocket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('REDACTED', 59025), raddr=('140.108.3.33', 80)>
```

This line references:
```
 593   │             try:
 594   │                 archive = self._download_archive(operation, link)
 595   │             except BaseException:
 596   │                 cache_directory = self._chef.get_cache_directory_for_link(link)
```

The issue is being caused because the session is being left open when the class is later cleaned up. By adding a destructor method, we can close the session if it exists, preventing this error.
parent 70670fa4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment