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

Cleanup all timeout code and places where we might timeout #910

Merged
merged 2 commits into from
Aug 24, 2022
Merged

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented Aug 23, 2022

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 or readtimeout. Also for our
ssl 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:

  • a new try_with_timeout function to provide a consistent way to run
    code while waiting for a timeout
  • use the new function in a number of places where we might be stuck waiting

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.

quinnj added 2 commits August 23, 2022 17:17
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` or `readtimeout`. Also for our
ssl 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:
  * a new `try_with_timeout` function to provide a consistent way to run
    code while waiting for a timeout
  * use the new function in a number of places where we might be stuck waiting

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.
@codecov-commenter
Copy link

codecov-commenter commented Aug 24, 2022

Codecov Report

Merging #910 (8031a17) into master (4d59f76) will increase coverage by 0.04%.
The diff coverage is 75.92%.

@@            Coverage Diff             @@
##           master     #910      +/-   ##
==========================================
+ Coverage   80.15%   80.20%   +0.04%     
==========================================
  Files          36       36              
  Lines        2908     2915       +7     
==========================================
+ Hits         2331     2338       +7     
  Misses        577      577              
Impacted Files Coverage Δ
src/connectionpools.jl 72.72% <ø> (ø)
src/ConnectionPool.jl 88.11% <56.52%> (-0.12%) ⬇️
src/clientlayers/ConnectionRequest.jl 78.48% <75.00%> (-0.74%) ⬇️
src/Exceptions.jl 91.17% <95.23%> (+6.56%) ⬆️
src/clientlayers/TimeoutRequest.jl 100.00% <100.00%> (+9.52%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@quinnj quinnj merged commit acd1ce7 into master Aug 24, 2022
@quinnj quinnj deleted the jq/909 branch August 24, 2022 00:33
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.

asyncmap never ends with HTTP.get
2 participants