gebn / bmc_exporter

Exposes Baseboard Management Controller data in Prometheus format.
GNU Lesser General Public License v3.0
47 stars 3 forks source link

Implement timeouts #39

Closed gebn closed 5 years ago

gebn commented 5 years ago

By default there are none; clients that open a conn and never send anything will cause goroutine leaks. Fix this entire class of bug. This is a good guide.

gebn commented 5 years ago

go1.12.9:

goroutine 307550856 [IO wait, 41 minutes]:
internal/poll.runtime_pollWait(0x7f2d0f2654c8, 0x72, 0xffffffffffffffff)
        GOROOT/src/runtime/netpoll.go:182 +0x56
internal/poll.(*pollDesc).wait(0xc008287918, 0x72, 0x1000, 0x1000, 0xffffffffffffffff)
        GOROOT/src/internal/poll/fd_poll_runtime.go:87 +0x9b
internal/poll.(*pollDesc).waitRead(...)
        GOROOT/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc008287900, 0xc005d10000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        GOROOT/src/internal/poll/fd_unix.go:169 +0x19b
net.(*netFD).Read(0xc008287900, 0xc005d10000, 0x1000, 0x1000, 0xc004bf6e80, 0xc001ac9938, 0x6a3d7a)
        GOROOT/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc000602b00, 0xc005d10000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        GOROOT/src/net/net.go:177 +0x69
net/http.(*connReader).Read(0xc008c38f00, 0xc005d10000, 0x1000, 0x1000, 0x0, 0xc001ac9c00, 0x6a76dc)
        GOROOT/src/net/http/server.go:787 +0x107
bufio.(*Reader).fill(0xc004b7af60)
        GOROOT/src/bufio/bufio.go:100 +0x10f
bufio.(*Reader).ReadSlice(0xc004b7af60, 0x435b0a, 0xc00161f800, 0xc001ac9b00, 0x40ba59, 0xc008d02700, 0x100)
        GOROOT/src/bufio/bufio.go:356 +0x3d
bufio.(*Reader).ReadLine(0xc004b7af60, 0xc001ac9b08, 0xc00047e000, 0x7f2d1177d300, 0x0, 0x4b71c2, 0xa324a0)
        GOROOT/src/bufio/bufio.go:385 +0x34
net/textproto.(*Reader).readLineSlice(0xc0081e3620, 0xc008d02700, 0xc008287900, 0x0, 0x0, 0x42cd21)
        GOROOT/src/net/textproto/reader.go:55 +0x6f
net/textproto.(*Reader).ReadLine(...)
        GOROOT/src/net/textproto/reader.go:36
net/http.readRequest(0xc004b7af60, 0x0, 0xc008d02700, 0x0, 0x0)
        GOROOT/src/net/http/request.go:968 +0x8d
net/http.(*conn).readRequest(0xc000ff3720, 0xb46740, 0xc006a953c0, 0x0, 0x0, 0x0)
        GOROOT/src/net/http/server.go:967 +0x163
net/http.(*conn).serve(0xc000ff3720, 0xb46740, 0xc006a953c0)
        GOROOT/src/net/http/server.go:1819 +0x6ad
created by net/http.(*Server).Serve
        GOROOT/src/net/http/server.go:2884 +0x2f4