Cleanup all timeout code and places where we might timeout #910
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #909. Great issue that stretches our current system and exposes
a bunch of places where we weren't accounting for timeouts. The core
issues here are when we have a proxy involved, we had a couple more
places where we were connecting/writing/reading, but weren't applying
a user-provided
connect_timeout
orreadtimeout
. Also for ourssl upgrade path. In the OP's example, we're hitting thousands of mostly
non-functional proxies, so it's basically a huge stress test on all the
error paths of our request code. This PR proposes:
try_with_timeout
function to provide a consistent way to runcode while waiting for a timeout
I'm able to get the original script OP provided to finish in ~150 seconds, and
I tried out a multithreaded version that finished in about ~17 seconds w/ 8 threads.