Skip to content

fix http leak#272

Merged
yannmh merged 5 commits intoDataDog:masterfrom
farmersbusinessnetwork:thehesiod/fix-http-client-leak
Jun 26, 2018
Merged

fix http leak#272
yannmh merged 5 commits intoDataDog:masterfrom
farmersbusinessnetwork:thehesiod/fix-http-client-leak

Conversation

@thehesiod
Copy link
Copy Markdown
Contributor

fixes #271

Copy link
Copy Markdown
Member

@truthbk truthbk left a comment

Choose a reason for hiding this comment

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

Almost good to go, thank you so much for this important fix! I'd love us to use a context manager though... 😊

u"Datadog's usage. We recommand upgrading it ('pip install -U requests')."
u"If you need help or have any question, please contact support@datadoghq.com"
)
finally:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Although this is 100% fine, I think I would prefer if we could use requests context manager for sessions...

we can basically wrap the entire method with:

with requests.Session() as s:
    http_adapter = requests.adapters.HTTPAdapter(max_retries=max_retries)
    s.mount('https://', http_adapter)
    
    # REST OF METHOD...

If you don't want to update that, just let me know as this is blatant nitpicking, and we can merge this as is!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

let me know what you think

@thehesiod
Copy link
Copy Markdown
Contributor Author

btw, for future reference, with help I found one of the leaks was due to python/cpython#4587, because this would cause a warning of unclosed socket

@thehesiod
Copy link
Copy Markdown
Contributor Author

failures don't seem related to my change

@yannmh
Copy link
Copy Markdown

yannmh commented Jun 26, 2018

Thanks @thehesiod !

@yannmh yannmh merged commit f926fe6 into DataDog:master Jun 26, 2018
@yannmh yannmh mentioned this pull request Jun 26, 2018
@thehesiod thehesiod deleted the thehesiod/fix-http-client-leak branch March 8, 2019 00:03
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.

leak with 3.6.4 and datadog.api.ServiceCheck.check

3 participants