Comments (7)
I have tested 0.4.0 on a http2 connection to www.google.com and with the gcs client. Worked like a charm with both.
Thank you for the work on this π
from hedgedhttp.
Thank you for filling this issue, I'm not a big pro of net/http
internals, so cannot answer so quickly, that's why I'm not sure about which path is the best.
There is #6 which removes context cancelling at all (we just use original context inside request, without creating own), but also there is a sub-context in closure for runInPool
and maybe the problem will be triggered there.
Sadly I don't have good bench/project/whatever where I can test it under real load (btw, can you share how much requests do you make when this problem appears?) and trying to debug in head and docs.
from hedgedhttp.
Also, jumping through the link from original PR I've found a thread on Google Groups, slightly changing the code I got something like this https://play.golang.org/p/iV2UMxZGPtr (you need to run it locally, url doesn't matter, feel free to change).
Locally this 'sometimes' appears to be 'always' π
from hedgedhttp.
I like the change in #6, but I think that we will need an optional cancel like was originally proposed. After you merge #6 I'll submit a PR for the optional cancel.
from hedgedhttp.
@joe-elliott idea is to cancel the context outside of the hedgehttp.
ctx, cancel := context.WithCancel(otherCtx)
defer cancel()
req := <create desired request>
req = req.WithContext(ctx)
// do hedgedhttp request
// read the body if it's present
// invoke cancel() here
In this way we're getting response, reading the body, canceling a context (it's scope is just to contain hedging), had a discussion with @storozhukBM yesterday, it may be slightly sub-optimal because we're not closing hanging requests as fast as possible, but it's a matter of 'how long do you process' the successfully received response.
I'm super eager to check how does #6 behaves in your situation and if it doesn't fix it, we can add optional cancelling or even cancelling failed requests manually (more code and more responsibility).
from hedgedhttp.
So, https://github.com/cristalhq/hedgedhttp/releases/tag/v0.3.0 is available, please test it π
from hedgedhttp.
So, #9 has landed. Please try it https://github.com/cristalhq/hedgedhttp/releases/tag/v0.4.0 :)
from hedgedhttp.
Related Issues (9)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hedgedhttp.