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

CurlAsyncHTTPClient: free_list starvation if setup fails #1582

Merged
merged 2 commits into from Nov 12, 2015

Conversation

minrk
Copy link
Contributor

@minrk minrk commented Nov 11, 2015

If _curl_setup_request fails, the failing curl instance would be permanently excluded from free_list, because _finish will never be called. Once this has happens max_clients times, no future request will ever complete.

This can be seen by requesting a non-ascii URL max_clients + 1 times.

If `_curl_setup_request` fails,
the failing curl instance would be permanently excluded from free_list,
because `_finish` will never be called.
Once this has happens `max_clients` times,
no future request will ever complete.
@ajdavis
Copy link
Contributor

ajdavis commented Nov 11, 2015

LGTM. Would you like to add a test in curl_httpclient_test.py that creates a CurlAsyncHTTPClient(max_clients=1) and tests this error-handling scenario?

@minrk
Copy link
Contributor Author

minrk commented Nov 11, 2015

Test added.

@ajdavis
Copy link
Contributor

ajdavis commented Nov 11, 2015

Nicely factored, thanks! But the unicode trick isn't causing the error you expect in Python 2.

ensure that it doesn't starve free curl client list
@minrk
Copy link
Contributor Author

minrk commented Nov 11, 2015

Removed the typecheck on the error, since it doesn't actually matter. The important thing is that failure of some sort doesn't cause it to hang.

@ajdavis
Copy link
Contributor

ajdavis commented Nov 12, 2015

@bdarnell I think we should merge this.

bdarnell added a commit that referenced this pull request Nov 12, 2015
CurlAsyncHTTPClient: free_list starvation if setup fails
@bdarnell bdarnell merged commit d5a4ebe into tornadoweb:master Nov 12, 2015
@bdarnell
Copy link
Member

Merged. Thanks!

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.

None yet

3 participants