线上的go web程序的标准输出里面有大量的, goroutine 24167 [IO wait]:, goroutine 24167 [runnablet]: goroutine 24299 [select] 请问这是什么原因导致的

goroutine 24167 [IO wait]:
net.runtime_pollWait(0x7fe4d0580118, 0x72, 0xc825ade000)
        /usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc8215c4060, 0x72, 0x0, 0x0)
        /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc8215c4060, 0x0, 0x0)
        /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc8215c4000, 0xc825ade000, 0x1000, 0x1000, 0x0, 0x7fe4e38a1050, 0xc820010008)
        /usr/local/go/src/net/fd_unix.go:250 +0x23a
net.(*conn).Read(0xc82068ea30, 0xc825ade000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/net.go:172 +0xe4
net/http.noteEOFReader.Read(0x7fe4e38ab390, 0xc82068ea30, 0xc8212937f8, 0xc825ade000, 0x1000, 0x1000, 0x405eb3, 0x0, 0x0)
        /usr/local/go/src/net/http/transport.go:1683 +0x67
net/http.(*noteEOFReader).Read(0xc821f99100, 0xc825ade000, 0x1000, 0x1000, 0xc823d57d1d, 0x0, 0x0)
        <autogenerated>:284 +0xd0
bufio.(*Reader).fill(0xc8208560c0)
        /usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(*Reader).Peek(0xc8208560c0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/bufio/bufio.go:132 +0xcc
net/http.(*persistConn).readLoop(0xc821293790)
        /usr/local/go/src/net/http/transport.go:1069 +0x177
created by net/http.(*Transport).dialConn
        /usr/local/go/src/net/http/transport.go:853 +0x10a6

goroutine 24624 [runnable]:
net/textproto.(*Reader).upcomingHeaderNewlines(0xc822f12c70, 0x3)
        /usr/local/go/src/net/textproto/reader.go:533
net/textproto.(*Reader).ReadMIMEHeader(0xc822f12c70, 0x8, 0x0, 0x0)
        /usr/local/go/src/net/textproto/reader.go:473 +0x5f
net/http.ReadResponse(0xc8257d48a0, 0xc82289e540, 0xc822f12e20, 0x0, 0x0)
        /usr/local/go/src/net/http/response.go:168 +0x68d
net/http.(*persistConn).readResponse(0xc821edaa90, 0xc82289e540, 0xc8257d49c0, 0x1, 0x0, 0xc8257d4900, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/http/transport.go:1228 +0x41
net/http.(*persistConn).readLoop(0xc821edaa90)
        /usr/local/go/src/net/http/transport.go:1086 +0x3ce
created by net/http.(*Transport).dialConn
        /usr/local/go/src/net/http/transport.go:853 +0x10a6

goroutine 24299 [select]:
net/http.(*persistConn).writeLoop(0xc8236da8f0)
        /usr/local/go/src/net/http/transport.go:1273 +0x472
created by net/http.(*Transport).dialConn
        /usr/local/go/src/net/http/transport.go:854 +0x10cb

goroutine 24594 [IO wait]:
net.runtime_pollWait(0x7fe4d8044548, 0x72, 0xc8262c7000)
        /usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc822a05090, 0x72, 0x0, 0x0)
        /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc822a05090, 0x0, 0x0)
        /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc822a05030, 0xc8262c7000, 0x1000, 0x1000, 0x0, 0x7fe4e38a1050, 0xc820010008)
        /usr/local/go/src/net/fd_unix.go:250 +0x23a
net.(*conn).Read(0xc8208ee8e8, 0xc8262c7000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/net.go:172 +0xe4
net/http.noteEOFReader.Read(0x7fe4e38ab390, 0xc8208ee8e8, 0xc821828fd8, 0xc8262c7000, 0x1000, 0x1000, 0x405eb3, 0x0, 0x0)
        /usr/local/go/src/net/http/transport.go:1683 +0x67
net/http.(*noteEOFReader).Read(0xc825e3f2e0, 0xc8262c7000, 0x1000, 0x1000, 0xc822d70d1d, 0x0, 0x0)
        <autogenerated>:284 +0xd0
bufio.(*Reader).fill(0xc824184300)
        /usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(*Reader).Peek(0xc824184300, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/bufio/bufio.go:132 +0xcc
net/http.(*persistConn).readLoop(0xc821828f70)
        /usr/local/go/src/net/http/transport.go:1069 +0x177
created by net/http.(*Transport).dialConn
        /usr/local/go/src/net/http/transport.go:853 +0x10a6

goroutine 24761 [IO wait]:
net.runtime_pollWait(0x7fe4d0788b68, 0x72, 0xc8209e5000)
        /usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc820df7d40, 0x72, 0x0, 0x0)
        /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc820df7d40, 0x0, 0x0)
        /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc820df7ce0, 0xc8209e5000, 0x1000, 0x1000, 0x0, 0x7fe4e38a1050, 0xc820010008)
        /usr/local/go/src/net/fd_unix.go:250 +0x23a
net.(*conn).Read(0xc82032ea80, 0xc8209e5000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/net.go:172 +0xe4
net/http.noteEOFReader.Read(0x7fe4e38ab390, 0xc82032ea80, 0xc822b88fd8, 0xc8209e5000, 0x1000, 0x1000, 0x405eb3, 0x0, 0x0)
        /usr/local/go/src/net/http/transport.go:1683 +0x67
net/http.(*noteEOFReader).Read(0xc8203e8a40, 0xc8209e5000, 0x1000, 0x1000, 0xc826193d1d, 0x0, 0x0)
        <autogenerated>:284 +0xd0
bufio.(*Reader).fill(0xc8213f3440)
        /usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(*Reader).Peek(0xc8213f3440, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/bufio/bufio.go:132 +0xcc
net/http.(*persistConn).readLoop(0xc822b88f70)
        /usr/local/go/src/net/http/transport.go:1069 +0x177
created by net/http.(*Transport).dialConn
        /usr/local/go/src/net/http/transport.go:853 +0x10a6

goroutine 24914 [select]:
net/http.(*Transport).getConn(0xc821f87980, 0xc8246bcb60, 0x0, 0xc821f86b40, 0x4, 0xc821f86b47, 0x11, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/http/transport.go:707 +0x4ef
net/http.(*Transport).RoundTrip(0xc821f87980, 0xc8246bcb60, 0xc821f87980, 0x0, 0x0)
        /usr/local/go/src/net/http/transport.go:307 +0x7e9
net/http.send(0xc8246bcb60, 0x7fe4e38a5550, 0xc821f87980, 0x0, 0x0, 0x0, 0xc821f87a40, 0x0, 0x0)
        /usr/local/go/src/net/http/client.go:260 +0x6b7
net/http.(*Client).send(0xc82581aba0, 0xc8246bcb60, 0x0, 0x0, 0x0, 0x18, 0x0, 0x0)
        /usr/local/go/src/net/http/client.go:155 +0x185
net/http.(*Client).doFollowingRedirects(0xc82581aba0, 0xc8246bcb60, 0xc16ea0, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/http/client.go:475 +0x8a4
net/http.(*Client).Do(0xc82581aba0, 0xc8246bcb60, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/http/client.go:188 +0xff
192.168.6.70/webyf/gocore/ser/httpclient.(*HttpClient).Do(0xc82255f3b0, 0xae7ae0, 0x3, 0xc821f86b40, 0xb5, 0xc8237b5410, 0x0, 0x0, 0x8000104, 0x0, ...)
        /data/gobuildpath/src/192.168.6.70/webyf/gocore/ser/httpclient/httpclient.go:587 +0x4cf
192.168.6.70/webyf/gocore/ser/httpclient.(*HttpClient).Get(0xc82255f3b0, 0xc821f86b40, 0xb5, 0xc8237b47b0, 0xc822ac7180, 0x0, 0x0)
        /data/gobuildpath/src/192.168.6.70/webyf/gocore/ser/httpclient/httpclient.go:597 +0xa1
192.168.6.70/webyf/gocore/ser.(*HttpClient).Get(0xc82581af90, 0xb84500, 0x21, 0xc8237b47b0, 0xc824a77b80, 0x0, 0x0, 0x0, 0x0)
        /data/gobuildpath/src/192.168.6.70/webyf/gocore/ser/http_client.go:93 +0x700
192.168.6.70/webyf/gocore/ser.HttpGet(0xb84500, 0x21, 0xc8237b47b0, 0xc824a77b80, 0x0, 0x0, 0x0, 0x0)
        /data/gobuildpath/src/192.168.6.70/webyf/gocore/ser/ser.go:28 +0xf9
zyapi/models/category.(*Category).GetCategoryBookList(0xc82581b230, 0x44, 0xb00140, 0x8, 0x0, 0xaeab50, 0x4, 0x1, 0xa, 0xc8210bd2d8, ...)
        /data/gobuildpath/src/zyapi/models/category/category.go:78 +0x5f2
zyapi/controllers.(*HuaweiController).GetBooksByCategoryId(0xc825eea600)
        /data/gobuildpath/src/zyapi/controllers/huawei.go:263 +0x7e9
reflect.Value.call(0xadaaa0, 0xc825eea600, 0x3213, 0xae71d8, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /usr/local/go/src/reflect/value.go:435 +0x120d
reflect.Value.Call(0xadaaa0, 0xc825eea600, 0x3213, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/reflect/value.go:303 +0xb1
192.168.6.70/golib/beego.(*ControllerRegister).ServeHTTP(0xc82006ba00, 0x7fe4e38ab460, 0xc82339de10, 0xc8246bc460)
        /data/gobuildpath/src/192.168.6.70/golib/beego/router.go:800 +0x22d6
net/http.serverHandler.ServeHTTP(0xc820092180, 0x7fe4e38ab460, 0xc82339de10, 0xc8246bc460)
        /usr/local/go/src/net/http/server.go:2081 +0x19e
net/http.(*conn).serve(0xc823907e00)
        /usr/local/go/src/net/http/server.go:1472 +0xf2e
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2137 +0x44e

goroutine 24895 [select]:
net/http.(*Transport).getConn(0xc820ecf080, 0xc820e89a40, 0x0, 0xc820ecefc0, 0x4, 0xc820ecefc7, 0x11, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/http/transport.go:707 +0x4ef
net/http.(*Transport).RoundTrip(0xc820ecf080, 0xc820e89a40, 0xc820ecf080, 0x0, 0x0)
        /usr/local/go/src/net/http/transport.go:307 +0x7e9
net/http.send(0xc820e89a40, 0x7fe4e38a5550, 0xc820ecf080, 0x0, 0x0, 0x0, 0xc820ecf140, 0x0, 0x0)
        /usr/local/go/src/net/http/client.go:260 +0x6b7
net/http.(*Client).send(0xc8231c0ba0, 0xc820e89a40, 0x0, 0x0, 0x0, 0x18, 0x0, 0x0)
        /usr/local/go/src/net/http/client.go:155 +0x185
net/http.(*Client).doFollowingRedirects(0xc8231c0ba0, 0xc820e89a40, 0xc16ea0, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/http/client.go:475 +0x8a4
net/http.(*Client).Do(0xc8231c0ba0, 0xc820e89a40, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/http/client.go:188 +0xff
192.168.6.70/webyf/gocore/ser/httpclient.(*HttpClient).Do(0xc823838e00, 0xae7ae0, 0x3, 0xc820ecefc0, 0xb5, 0xc823c1ea50, 0x0, 0x0, 0x7000105, 0x0, ...)
        /data/gobuildpath/src/192.168.6.70/webyf/gocore/ser/httpclient/httpclient.go:587 +0x4cf
192.168.6.70/webyf/gocore/ser/httpclient.(*HttpClient).Get(0xc823838e00, 0xc820ecefc0, 0xb5, 0xc823b01dd0, 0xc820838c00, 0x0, 0x0)
        /data/gobuildpath/src/192.168.6.70/webyf/gocore/ser/httpclient/httpclient.go:597 +0xa1
192.168.6.70/webyf/gocore/ser.(*HttpClient).Get(0xc8231c0f90, 0xb84500, 0x21, 0xc823b01dd0, 0xc825705340, 0x0, 0x0, 0x0, 0x0)
        /data/gobuildpath/src/192.168.6.70/webyf/gocore/ser/http_client.go:93 +0x700
192.168.6.70/webyf/gocore/ser.HttpGet(0xb84500, 0x21, 0xc823b01dd0, 0xc825705340, 0x0, 0x0, 0x0, 0x0)
        /data/gobuildpath/src/192.168.6.70/webyf/gocore/ser/ser.go:28 +0xf9
zyapi/models/category.(*Category).GetCategoryBookList(0xc8231c1230, 0x44, 0xb00140, 0x8, 0x0, 0xaeab50, 0x4, 0x1, 0xa, 0xc820384178, ...)
        /data/gobuildpath/src/zyapi/models/category/category.go:78 +0x5f2
zyapi/controllers.(*HuaweiController).GetBooksByCategoryId(0xc822d22800)
        /data/gobuildpath/src/zyapi/controllers/huawei.go:263 +0x7e9
reflect.Value.call(0xadaaa0, 0xc822d22800, 0x3213, 0xae71d8, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /usr/local/go/src/reflect/value.go:435 +0x120d
reflect.Value.Call(0xadaaa0, 0xc822d22800, 0x3213, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/reflect/value.go:303 +0xb1
192.168.6.70/golib/beego.(*ControllerRegister).ServeHTTP(0xc82006ba00, 0x7fe4e38ab460, 0xc822956270, 0xc820e89340)
        /data/gobuildpath/src/192.168.6.70/golib/beego/router.go:800 +0x22d6
net/http.serverHandler.ServeHTTP(0xc820092180, 0x7fe4e38ab460, 0xc822956270, 0xc820e89340)
        /usr/local/go/src/net/http/server.go:2081 +0x19e
net/http.(*conn).serve(0xc823907c80)
        /usr/local/go/src/net/http/server.go:1472 +0xf2e
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2137 +0x44e

goroutine 24485 [IO wait]:
net.runtime_pollWait(0x7fe4e37aa8b8, 0x72, 0xc822642000)
        /usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc8216fe290, 0x72, 0x0, 0x0)
        /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc8216fe290, 0x0, 0x0)
        /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc8216fe230, 0xc822642000, 0x1000, 0x1000, 0x0, 0x7fe4e38a1050, 0xc820010008)
        /usr/local/go/src/net/fd_unix.go:250 +0x23a
net.(*conn).Read(0xc82003eac8, 0xc822642000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/net.go:172 +0xe4
net/http.noteEOFReader.Read(0x7fe4e38ab390, 0xc82003eac8, 0xc8223806e8, 0xc822642000, 0x1000, 0x1000, 0x405eb3, 0x0, 0x0)
        /usr/local/go/src/net/http/transport.go:1683 +0x67
net/http.(*noteEOFReader).Read(0xc82202c900, 0xc822642000, 0x1000, 0x1000, 0xc8223d4d1d, 0x0, 0x0)
        <autogenerated>:284 +0xd0
bufio.(*Reader).fill(0xc820f1a000)
        /usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(*Reader).Peek(0xc820f1a000, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/bufio/bufio.go:132 +0xcc
net/http.(*persistConn).readLoop(0xc822380680)
        /usr/local/go/src/net/http/transport.go:1069 +0x177
created by net/http.(*Transport).dialConn
        /usr/local/go/src/net/http/transport.go:853 +0x10a6

goroutine 23818 [IO wait]:
net.runtime_pollWait(0x7fe4d03bf798, 0x72, 0xc822c1d000)
        /usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc82371b5d0, 0x72, 0x0, 0x0)
        /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc82371b5d0, 0x0, 0x0)
        /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc82371b570, 0xc822c1d000, 0x1000, 0x1000, 0x0, 0x7fe4e38a1050, 0xc820010008)
        /usr/local/go/src/net/fd_unix.go:250 +0x23a
net.(*conn).Read(0xc8204bc6f0, 0xc822c1d000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/net.go:172 +0xe4
net/http.noteEOFReader.Read(0x7fe4e38ab390, 0xc8204bc6f0, 0xc821293da8, 0xc822c1d000, 0x1000, 0x1000, 0x405eb3, 0x0, 0x0)
        /usr/local/go/src/net/http/transport.go:1683 +0x67
net/http.(*noteEOFReader).Read(0xc8228018a0, 0xc822c1d000, 0x1000, 0x1000, 0xc825663d1d, 0x0, 0x0)
        <autogenerated>:284 +0xd0
bufio.(*Reader).fill(0xc8229b38c0)
        /usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(*Reader).Peek(0xc8229b38c0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/bufio/bufio.go:132 +0xcc
net/http.(*persistConn).readLoop(0xc821293d40)
        /usr/local/go/src/net/http/transport.go:1069 +0x177
created by net/http.(*Transport).dialConn
        /usr/local/go/src/net/http/transport.go:853 +0x10a6

goroutine 24506 [IO wait]:
net.runtime_pollWait(0x7fe4d067d948, 0x72, 0xc821570000)
        /usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc8216ad950, 0x72, 0x0, 0x0)
        /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc8216ad950, 0x0, 0x0)
        /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc8216ad8f0, 0xc821570000, 0x1000, 0x1000, 0x0, 0x7fe4e38a1050, 0xc820010008)
        /usr/local/go/src/net/fd_unix.go:250 +0x23a
net.(*conn).Read(0xc8204b8c60, 0xc821570000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/net.go:172 +0xe4
net/http.noteEOFReader.Read(0x7fe4e38ab390, 0xc8204b8c60, 0xc8216a7b38, 0xc821570000, 0x1000, 0x1000, 0x405eb3, 0x0, 0x0)
        /usr/local/go/src/net/http/transport.go:1683 +0x67
net/http.(*noteEOFReader).Read(0xc8201cd1c0, 0xc821570000, 0x1000, 0x1000, 0xc822d9fd1d, 0x0, 0x0)
        <autogenerated>:284 +0xd0
bufio.(*Reader).fill(0xc820f08180)
        /usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(*Reader).Peek(0xc820f08180, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/bufio/bufio.go:132 +0xcc
net/http.(*persistConn).readLoop(0xc8216a7ad0)
        /usr/local/go/src/net/http/transport.go:1069 +0x177
created by net/http.(*Transport).dialConn
        /usr/local/go/src/net/http/transport.go:853 +0x10a6

共 6 个回复


sephrouse

似乎是goroutine太多了,硬件不能及时处理这些goroutine。把goroutine限制在1000内试试。

# 0

wjlight

你好,我这边也出现了这种请况,请问下,你有解决这个问题么?

# 1

alphayan

这当然是哪里崩溃了

# 2

foreverppaul

一样的问题诶,请问怎么解决的

# 3

zhao6810

之前也遇到过这个问题,感觉应该是内存泄漏造成的。这个问题排查起来很复杂啊。

# 4

linmo

一样的问题,请问楼上怎么解决的,谢谢!

# 5