FAQ
Hi,
go version go1.4.1 linux/amd64

I have implemented a http server which does the work of a reverse proxy
with some additional functionality. It has been running in production for
more than 2 months now and I've observed that the memory keeps on
increasing.

When I used profiling(browser based), I got the following :-
/debug/pprof/

profiles:
0block <http://10.150.132.49:8080/debug/pprof/block?debug=1>20953goroutine
<http://10.150.132.49:8080/debug/pprof/goroutine?debug=1>717heap
<http://10.150.132.49:8080/debug/pprof/heap?debug=1>570threadcreate
<http://10.150.132.49:8080/debug/pprof/threadcreate?debug=1>
full goroutine stack dump
<http://10.150.132.49:8080/debug/pprof/goroutine?debug=2>

When I inspected the goroutine stack dump I found that more than 20K
goroutines are waiting for I/O with the same call trace :-

goroutine 763144402 [*IO wait, 46971 minutes*]:
net.(*pollDesc).Wait(0xc672766f40, 0x72, 0x0, 0x0)
  /usr/local/go/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc672766f40, 0x0, 0x0)
  /usr/local/go/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc672766ee0, 0xc651362000, 0x1000, 0x1000, 0x0, 0x7fe5bc41ad80, 0xc65133d5d0)
  /usr/local/go/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc476b477f0, 0xc651362000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
  /usr/local/go/src/net/net.go:121 +0xdc
net/http.(*liveSwitchReader).Read(0xc672725a88, 0xc651362000, 0x1000, 0x1000, 0x2, 0x0, 0x0)
  /usr/local/go/src/net/http/server.go:214 +0xab
io.(*LimitedReader).Read(0xc4191cbea0, 0xc651362000, 0x1000, 0x1000, 0x2, 0x0, 0x0)
  /usr/local/go/src/io/io.go:408 +0xce
bufio.(*Reader).fill(0xc540048900)
  /usr/local/go/src/bufio/bufio.go:97 +0x1ce
bufio.(*Reader).ReadSlice(0xc540048900, 0xc54008eb0a, 0x0, 0x0, 0x0, 0x0, 0x0)
  /usr/local/go/src/bufio/bufio.go:295 +0x257
bufio.(*Reader).ReadLine(0xc540048900, 0x0, 0x0, 0x0, 0xc1b6c61900, 0x0, 0x0)
  /usr/local/go/src/bufio/bufio.go:324 +0x62
net/textproto.(*Reader).readLineSlice(0xc71b9e61b0, 0x0, 0x0, 0x0, 0x0, 0x0)
  /usr/local/go/src/net/textproto/reader.go:55 +0x9e
net/textproto.(*Reader).ReadLine(0xc71b9e61b0, 0x0, 0x0, 0x0, 0x0)
  /usr/local/go/src/net/textproto/reader.go:36 +0x4f
net/http.ReadRequest(0xc540048900, 0xc42eb329c0, 0x0, 0x0)
  /usr/local/go/src/net/http/request.go:598 +0xcb
net/http.(*conn).readRequest(0xc672725a40, 0x0, 0x0, 0x0)
  /usr/local/go/src/net/http/server.go:586 +0x26f
net/http.(*conn).serve(0xc672725a40)
  /usr/local/go/src/net/http/server.go:1162 +0x69e
created by net/http.(*Server).Serve
  /usr/local/go/src/net/http/server.go:1751 +0x35e


Calls to my server come from other servers(and not browser). Secondly, my server doesn't close the connection ever(for performance reasons), but clients do(whenever response time exceeds, say 200ms).


I haven't configured any "ReadTimeout"(or writeTimeout) in my server, I wonder why these goroutines are waiting for days.


Has anyone else faced a similar problem? Does this occur when the client closes the connection while the goroutine is still reading? The memory on my server has been increasing steadily as the # of goroutines that enter into this "wait" state keeps on increasing.


Thanks for your patience

Regards

kartik

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

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 14 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 2, '15 at 12:29p
activeSep 4, '15 at 1:48p
posts14
users5
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase