Note that there are some explanatory texts on larger screens.

plurals
  1. POGolang: http server leaving open goroutines
    primarykey
    data
    text
    <p>I've put up an http server written in Go and it's getting a little over a thousand visitors a day. I have an accumulating Goroutine problem now. Over the course of a day I seem to get a little over a thousand new Goroutines from the http server.</p> <p>I'm not sure how I could mess up the handler.</p> <pre><code>http.Handle("/", http.FileServer(http.Dir(config.htdocs_path))) </code></pre> <p>Below is one of the goroutines from the stack</p> <pre><code>goroutine 1582 [chan receive]: net.(*pollServer).WaitRead(0xf84007f680, 0xf84066dea0, 0xf84007aa80, 0xb, 0x1, ...) /home/ec2-user/go/src/pkg/net/fd.go:268 +0x73 net.(*netFD).Read(0xf84066dea0, 0xf840ec1000, 0x100000001000, 0x7f7effffffff, 0xf84007c0f0, ...) /home/ec2-user/go/src/pkg/net/fd.go:428 +0x1ec net.(*TCPConn).Read(0xf84068aff8, 0xf840ec1000, 0x100000001000, 0xf800000002, 0x0, ...) /home/ec2-user/go/src/pkg/net/tcpsock_posix.go:87 +0xce io.(*LimitedReader).Read(0xf840d1bc20, 0xf840ec1000, 0x100000001000, 0xdcb00000000, 0x0, ...) /home/ec2-user/go/src/pkg/io/io.go:394 +0xc1 bufio.(*Reader).fill(0xf8405b0900, 0xdcb00000000) /home/ec2-user/go/src/pkg/bufio/bufio.go:77 +0xf0 bufio.(*Reader).ReadSlice(0xf8405b0900, 0xf840d1bc0a, 0x0, 0x0, 0x0, ...) /home/ec2-user/go/src/pkg/bufio/bufio.go:257 +0x1b6 bufio.(*Reader).ReadLine(0xf8405b0900, 0x0, 0x0, 0x0, 0x0, ...) /home/ec2-user/go/src/pkg/bufio/bufio.go:283 +0x5b net/textproto.(*Reader).readLineSlice(0xf840730660, 0xc0, 0x100000000, 0x7f7e00000001) /home/ec2-user/go/src/pkg/net/textproto/reader.go:55 +0x4f net/textproto.(*Reader).ReadLine(0xf840730660, 0xf84061f300, 0x0, 0x48411c) /home/ec2-user/go/src/pkg/net/textproto/reader.go:36 +0x25 net/http.ReadRequest(0xf8405b0900, 0xf84061f300, 0x0, 0x0, 0x100000400ccf60, ...) /home/ec2-user/go/src/pkg/net/http/request.go:457 +0xb1 net/http.(*conn).readRequest(0xf8402b2b40, 0xf8400e3fc0, 0x0, 0x0, 0xf8405b0a80, ...) /home/ec2-user/go/src/pkg/net/http/server.go:240 +0xa8 net/http.(*conn).serve(0xf8402b2b40, 0x0) /home/ec2-user/go/src/pkg/net/http/server.go:594 +0x145 created by net/http.(*Server).Serve /home/ec2-user/go/src/pkg/net/http/server.go:1040 +0x430 </code></pre> <p>It seems like connections are getting stuck in the read state. Like the http server isn't timing them out. Does the default server not have a read timeout?</p> <p>go version go1</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload