FAQ


I am leaking goroutines. I've been assuming that they get GC'd eventually,
but it's sloppy code.

Buffering sounds like a good solution. Can you point me in the right
direction of what to read up on?
To be absolutely certain that all download goroutines can complete without
a receiver on articleChan, you would have to make articleChan large enough
to hold all responses. (http://golang.org/doc/effective_go.html#channels)

articleChan := make(chan string, len(urlsSlice))


You're also not checking the error from reading the resp.Body. Again,
probably not the issue here, but your response may not be what you think it
is.
I made the articleChan channel larger, which seems to have reduced the
overall number of panics. But I'm still seeing the same panics in
transport.go, at writeLoop() and readLoop():


goroutine 1494 [select]:
net/http.(*persistConn).writeLoop(0xc2086722c0)
         /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

goroutine 2604 [select]:
net/http.(*persistConn).readLoop(0xc209c62bb0)
         /root/.gvm/gos/go1.4rc2/src/net/http/transport.go:928 +0x9ce
created by net/http.(*Transport).dialConn
         /root/.gvm/gos/go1.4rc2/src/net/http/transport.go:660 +0xc9f
panic: send on closed channel


also seeing a new panic:

goroutine 315 [IO wait]:
net.(*pollDesc).Wait(0xc208011330, 0x77, 0x0, 0x0)
         /root/.gvm/gos/go1.4rc2/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitWrite(0xc208011330, 0x0, 0x0)
         /root/.gvm/gos/go1.4rc2/src/net/fd_poll_runtime.go:93 +0x43
net.(*netFD).connect(0xc2080112d0, 0x0, 0x0, 0x7fe9016b2a80, 0xc208563320,
0x0, 0x0, 0x0, 0x0, 0x0)
         /root/.gvm/gos/go1.4rc2/src/net/fd_unix.go:114 +0x24b
net.(*netFD).dial(0xc2080112d0, 0x7fe9016ac658, 0x0, 0x7fe9016ac658,
0xc208294870, 0x0, 0x0, 0x0, 0x0, 0x0)
         /root/.gvm/gos/go1.4rc2/src/net/sock_posix.go:139 +0x37a
net.socket(0x7f8490, 0x3, 0x2, 0x1, 0x0, 0xc208294800, 0x7fe9016ac658, 0x0,
0x7fe9016ac658, 0xc208294870, ...)
         /root/.gvm/gos/go1.4rc2/src/net/sock_posix.go:91 +0x422
net.internetSocket(0x7f8490, 0x3, 0x7fe9016ac658, 0x0, 0x7fe9016ac658,
0xc208294870, 0x0, 0x0, 0x0, 0x1, ...)
         /root/.gvm/gos/go1.4rc2/src/net/ipsock_posix.go:137 +0x148
net.dialTCP(0x7f8490, 0x3, 0x0, 0xc208294870, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
         /root/.gvm/gos/go1.4rc2/src/net/tcpsock_posix.go:156 +0x125
net.dialSingle(0x7f8490, 0x3, 0xc20813f160, 0x15, 0x0, 0x0, 0x7fe9016ac5f0,
0xc208294870, 0x0, 0x0, ...)
         /root/.gvm/gos/go1.4rc2/src/net/dial.go:235 +0x3f5
net.func·016(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
         /root/.gvm/gos/go1.4rc2/src/net/dial.go:163 +0x12c
net.dial(0x7f8490, 0x3, 0x7fe9016ac5f0, 0xc208294870, 0xc2085d7b08, 0x0,
0x0, 0x0, 0x0, 0x0, ...)
         /root/.gvm/gos/go1.4rc2/src/net/fd_unix.go:40 +0x6f
net.(*Dialer).Dial(0xc2085e60c0, 0x7f8490, 0x3, 0xc20813f160, 0x15, 0x0,
0x0, 0x0, 0x0)
         /root/.gvm/gos/go1.4rc2/src/net/dial.go:170 +0x4be
net.Dial(0x7f8490, 0x3, 0xc20813f160, 0x15, 0x0, 0x0, 0x0, 0x0)
         /root/.gvm/gos/go1.4rc2/src/net/dial.go:143 +0x8a
net/http.(*Transport).dial(0xc208052000, 0x7f8490, 0x3, 0xc20813f160, 0x15,
0x0, 0x0, 0x0, 0x0)
         /root/.gvm/gos/go1.4rc2/src/net/http/transport.go:481 +0xcf
net/http.(*Transport).dialConn(0xc208052000, 0x0, 0xc208162058, 0x4,
0xc20813f160, 0x15, 0x1, 0x0, 0x0)
         /root/.gvm/gos/go1.4rc2/src/net/http/transport.go:564 +0x1678
net/http.func·019()
         /root/.gvm/gos/go1.4rc2/src/net/http/transport.go:520 +0x42
created by net/http.(*Transport).getConn
         /root/.gvm/gos/go1.4rc2/src/net/http/transport.go:522 +0x335
panic: send on closed channel

--
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.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 12 of 15 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 19, '15 at 4:38p
activeJan 21, '15 at 3:59p
posts15
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase