On Tuesday, January 20, 2015 at 9:13:52 AM UTC-5, Lars Tørnes Hansen wrote:
Put 'defer resp.Body.Close()' in the top of the function, otherwise resp
is not closed, if err != nil is true
Put 'defer resp.Body.Close()' in the top of the function, otherwise resp
is not closed, if err != nil is true
panic.
Den mandag den 19. januar 2015 kl. 17.38.20 UTC+1 skrev akib...@gmail.com:
Is this the entire stack trace? DO you have something that can can reliablyHi Everyone,
I hope this isn't a duplicate issue but:
I have a number of goroutines that each download a url. After a certain
cutoff point (a timeout), main code execution moves on, leaving goroutines
that didn't finish basically hanging.
See: http://play.golang.org/p/OlPuERL2kQ
Doing this, I'm getting:
net/http.(*persistConn).writeLoop(0xc208351810)
/root/.gvm/gos/go1.4rc2/src/net/http/transport.go:945 +0x41d
created by net/http.(*Transport).dialConn
/root/.gvm/gos/go1.4rc2/src/net/http/transport.go:661 +0xcbc
panic: send on closed channel
I hope this isn't a duplicate issue but:
I have a number of goroutines that each download a url. After a certain
cutoff point (a timeout), main code execution moves on, leaving goroutines
that didn't finish basically hanging.
See: http://play.golang.org/p/OlPuERL2kQ
Doing this, I'm getting:
net/http.(*persistConn).writeLoop(0xc208351810)
/root/.gvm/gos/go1.4rc2/src/net/http/transport.go:945 +0x41d
created by net/http.(*Transport).dialConn
/root/.gvm/gos/go1.4rc2/src/net/http/transport.go:661 +0xcbc
panic: send on closed channel
reproduce the panic (preferably without using external web properties)?
I found an SO that suggests that resp.Body is probably causing the issue:
The OP there commented that it was because the Body wasn't being closed.http://stackoverflow.com/questions/25152030/panic-in-golang-http-client-with-high-concurrent-excecutions
But the SO doesn't specify the best way to fix this.
But the SO doesn't specify the best way to fix this.
Is reading resp.Body the likely source of error?
What would be the best way to handle this?
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.