canonical / canonical/cloud-init
tcp: Re-use tcp sessions
Open
bug
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
# Bug report
While investigating https://github.com/canonical/cloud-init/pull/5144, I realized that the code that is supposed to be re-using TCP session doesn't work correctly. The Session object gets re-used, however each individual call to `readurl()` ultimately creates a new session.
Session creation -> https://github.com/canonical/cloud-init/blob/120adcc1917a7e1157ad82615c202bf1a8d231fe/cloudinit/url_helper.py#L445
To reuse connections, we should create the session context outside of `readurl()`.
Contributor guide
Assessment
This issue has not been assessed yet.