Skip to content
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

HTTP requests to SendGrid can hang as SendGridAPIClient does not have a timeout. #757

Closed
dashk opened this issue Feb 15, 2019 · 6 comments
Closed
Labels
difficulty: medium fix is medium in difficulty status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap

Comments

@dashk
Copy link

dashk commented Feb 15, 2019

Issue Summary

HTTP requests to SendGrid could hang, as SendGridAPIClient has no time out defined in case of a network anomaly.

Steps to Reproduce

This is a bit difficult to reproduce, as it could be caused by a network anomaly (Not necessarily SendGrid's issue).

When a network anomaly occurred, it is possible for API calls to SendGrid to hang indefinitely.

  • By default, the HTTP client's timeout defaults to None.
  • When SendGridAPIClient creates a client, it does not allow a timeout to be passed in.
  • User of the client, unfortunately, has no way to provide a timeout, unless s/he creates a wrapper on top of SendGridAPIClient to override SendGridAPIClient.client or to have an outer wrapper to control timeout.

Expected Behavior
Either a reasonable timeout is set, or a timeout option should be allowed when creating a SendGridAPIClient.

Actual
None is available.

Technical details:

  • sendgrid-python Version: master
  • Python Version: 2.7
  • python-http-client Version: master

Relevant Link:

@thinkingserious thinkingserious added type: community enhancement feature request not on Twilio's roadmap status: help wanted requesting help from the community difficulty: medium fix is medium in difficulty help wanted labels Feb 24, 2019
@thinkingserious
Copy link
Contributor

Great catch! I've tagged this appropriately and the fix should happen on the v4 branch here..

With Best Regards,

Elmer

@erdnaxeli
Copy link

It seems it is still not fixed in the last versions, am I right?

@thinkingserious
Copy link
Contributor

It did not @erdnaxeli, but thanks for the comment. Your comment helps us move this up the ladder in our backlog. Thanks!

@QuicksilverMachine
Copy link

We've had the same problem recently, for now I've fixed it with:

sendgrid_client = sendgrid.SendGridAPIClient()
sendgrid_client.client.timeout = 10

Hopefully this will be fixed soon, being able to set the timeout when initializing the client would be great.

@thinkingserious
Copy link
Contributor

Since there has been no activity on this issue since March 1, 2020, we are closing this issue. Please feel free to reopen or create a new issue if you still require assistance. Thank you!

@matheusbrat
Copy link

I'm also having this issue on python 3.7 and sendgrid==6.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: medium fix is medium in difficulty status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

No branches or pull requests

6 participants