8000 Catch OSError to avoid socket leak by anecdata · Pull Request #70 · adafruit/Adafruit_CircuitPython_Requests · GitHub
[go: up one dir, main page]

Skip to content

Catch OSError to avoid socket leak #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2021
Merged

Catch OSError to avoid socket leak #70

merged 1 commit into from
Feb 5, 2021

Conversation

anecdata
Copy link
Member
@anecdata anecdata commented Feb 4, 2021

Catch OSError along with _SendFailed to avoid RuntimeError: Out of sockets caused by OSError: Failed SSL handshake

Background:
#63 (comment)

This should address #67

Copy link
Contributor
@jerryneedell jerryneedell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on ESP32s2 SAOLA WROVER as part of adafruit/circuitpython#4061
This resolved that issue

@anecdata
Copy link
Member Author
anecdata commented Feb 5, 2021

Does anyone else want to weigh in... @brentru @tannewt ?

@@ -560,7 +560,7 @@ def request(
ok = True
try:
self._send_request(socket, host, method, path, headers, data, json)
except _SendFailed:
except (_SendFailed, OSError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anecdata I think this achieves your conclusion in #63, closing the failed socket and opening a new one.

Copy link
Member
@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me!

@anecdata anecdata merged commit 7b1fc6f into adafruit:master Feb 5, 2021
@anecdata anecdata deleted the outofsockets branch February 5, 2021 19:57
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0