Re: [go-nuts] Races in net/http when redirecting request - expected?

2019-03-06 Thread virrages
> > My thought then is that access to reads and writes on the req.Body must > be serialized to avoid a race condition. > Could you elaborate on how you concluded that? Preserves, does not mean 'takes ownership' as I understand. Using a mutex for this prevented the race conditions. But this

[go-nuts] Re: Races in net/http when redirecting request - expected?

2019-03-05 Thread virrages
> There are 1000 go routines started here, each of them using the same > customReader. This where the data race comes from. I think you are mistaken. I create customReader for EACH of the goroutines. Notice that in every loop I pass it to the goroutine func. And if you want you can remove t

[go-nuts] Races in net/http when redirecting request - expected?

2019-03-05 Thread virrages
I've been playing with server which redirects requests but then I noticed weird races. What is odd that if these races are expected it would mean that using `*File` in `req.Body`, for requests which are redirected, is not safe - this is because we have races between `Read` and `Close`. I've run