mdlayher / rtorrent_exporter

Prometheus exporter that exposes metrics from rTorrent. MIT Licensed.
MIT License
40 stars 15 forks source link

"http: superfluous response.WriteHeader call" error when adding a dozen torrents #11

Open barnumbirr opened 3 years ago

barnumbirr commented 3 years ago

Hello,

rtorrent_exporter seems to have trouble when adding more than a couple of torrents at the same time These are the logs produced when adding 13 torrents:

Nov 14 16:59:55 helios64 rtorrent_exporter[1252]: 2020/11/14 08:59:55 http: superfluous response.WriteHeader call from github.com/prometheus/client_golang/prometheus/promhttp.(*responseWriterDelegator).WriteHeader (delegator.go:58)
Nov 14 16:59:57 helios64 rtorrent_exporter[1252]: 2020/11/14 08:59:57 http: superfluous response.WriteHeader call from github.com/prometheus/client_golang/prometheus/promhttp.(*responseWriterDelegator).WriteHeader (delegator.go:58)
Nov 14 16:59:59 helios64 rtorrent_exporter[1252]: 2020/11/14 08:59:59 http: superfluous response.WriteHeader call from github.com/prometheus/client_golang/prometheus/promhttp.(*responseWriterDelegator).WriteHeader (delegator.go:58)
Nov 14 17:00:01 helios64 rtorrent_exporter[1252]: 2020/11/14 09:00:01 http: superfluous response.WriteHeader call from github.com/prometheus/client_golang/prometheus/promhttp.(*responseWriterDelegator).WriteHeader (delegator.go:58)
Nov 14 17:00:04 helios64 rtorrent_exporter[1252]: 2020/11/14 09:00:04 http: superfluous response.WriteHeader call from github.com/prometheus/client_golang/prometheus/promhttp.(*responseWriterDelegator).WriteHeader (delegator.go:58)
Nov 14 17:00:06 helios64 rtorrent_exporter[1252]: 2020/11/14 09:00:06 http: superfluous response.WriteHeader call from github.com/prometheus/client_golang/prometheus/promhttp.(*responseWriterDelegator).WriteHeader (delegator.go:58)

Is there anything I can do to help debug this further?

Cheers.

EDIT: also happens when adding 3 torrents:

Nov 16 13:55:51 helios64 rtorrent_exporter[3650]: 2020/11/16 13:55:51 http: superfluous response.WriteHeader call from github.com/prometheus/client_golang/prometheus/promhttp.(*responseWriterDelegator).WriteHeader (delegator.go:58)
Nov 16 13:59:16 helios64 rtorrent_exporter[3650]: 2020/11/16 13:59:16 http: superfluous response.WriteHeader call from github.com/prometheus/client_golang/prometheus/promhttp.(*responseWriterDelegator).WriteHeader (delegator.go:58)
Nov 16 14:02:32 helios64 rtorrent_exporter[3650]: 2020/11/16 14:02:31 http: superfluous response.WriteHeader call from github.com/prometheus/client_golang/prometheus/promhttp.(*responseWriterDelegator).WriteHeader (delegator.go:58)
barnumbirr commented 3 years ago

After some investigating, it seems upgrading prometheus/client_golang to version 1.5.1 or later is supposed to fix the issue. (sources: #1, #2). That does indeed seem to "fix" the issue as the error logs don't show up anymore. There is however still an underlying issue as the metrics are not exported.