Re: [go-nuts] Re: context cancellation flake

2017-09-17 Thread Jesper Louis Andersen
On Sun, Sep 17, 2017 at 12:46 PM Steven Lee wrote: > Thank you Silviu, that seems to work. > > Do you know exactly why it flakes? what is racing? just for me to have an > understanding of why this happens > > It is somewhat common to use the TCP window as a feedback mechanism to the server. If yo

[go-nuts] Re: context cancellation flake

2017-09-17 Thread silviucapota
Steven, no problem. For more details have a look at a) This talk by Sameer Ajmani: https://vimeo.com/115309491 b) Francesc Campoy's series of videos: https://github.com/campoy/justforfunc In the Readme, you'll find likes to episodes 9 and 10, which deal with explaning and implementing the conte

[go-nuts] Re: context cancellation flake

2017-09-17 Thread Steven Lee
Thank you Silviu, that seems to work. Do you know exactly why it flakes? what is racing? just for me to have an understanding of why this happens On Sunday, 17 September 2017 01:19:35 UTC+1, Silviu Capota Mera wrote: > > Hi Steven, > > In case it's still unclear, you need to wrap both the "do re

[go-nuts] Re: context cancellation flake

2017-09-16 Thread silviucapota
Hi Steven, In case it's still unclear, you need to wrap both the "do request" + "read body" inside the same cancellation context. The "defer cancel" should encompass both of them, sort of atomically, so the idea is to take it out of your fetch, one level up. https://play.golang.org/p/trMP7Q-ma

[go-nuts] Re: context cancellation flake

2017-09-16 Thread Steven Lee
I guess thats plausible Ive tried to find the code in the library that sets the body if a context is cancelled but cant, I understand how to fix the code just struggling to understand the mechanics and especially why it flakes :( -- You received this message because you are subscribed to the G

[go-nuts] Re: context cancellation flake

2017-09-16 Thread Tamás Gulácsi
No, but may cancel the reading before completion. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visi

[go-nuts] Re: context cancellation flake

2017-09-16 Thread Steven Lee
Does calling the cancel func on a context that is attached to a http.Request change the contents of the body to context cancellation? On Friday, 15 September 2017 18:15:25 UTC+1, Steven Lee wrote: > > Hello, > > I was wondering if anyone could help me with understanding the behaviour > of cancel