New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http: superfluous response.WriteHeader call #257
Comments
interesting … this seems to happen on a cycle of a little bit more than 30s but not always. Do you have more than one Prometheus scraping these? Can you find out if their scrape cycles are aligned? |
I'm wondering if this is a race condition with the |
Only one Prometheus is scraping this endpoint (on an interval of 5 seconds). statsd_exporter lives in its own container and prometheus lives in its own container. Both are on the same host machine and started together on system boot via docker-compose. |
Here's a full 24 hour log dump (seems there is no discernible cycle or pattern to it): https://hastebin.com/raw/zeyakuqela |
The code in I'm wondering if we need In any case, the superfluous call must originate from higher up the stack. Apparently, the standard |
Now I at least understand why we have the WriteHeader check: Because we want to observe the status code when WriteHeader is called, so we don't leave it to the underlying implementation to call it. |
The race @matthiasr proposed could certainly happen if multiple |
I'll check implementations from the standard library. If they aren't concurrency-safe either, we know that it's just not OK to call |
I have confirmed that the standard library implementation of a ResponseWriter is following the same assumptions (that Write and friends won't be called concurrently). Thus, my theory here is that in statsd_exporter (and also in caddy?) some concurrent calling is involved that leads to spurious calls of WriteHeader. If I am right, then we have a data race here (which should also show up with the race detector). In different news, my research revealed that |
Interesting, we are seeing the same issue here as well. Happens about every 30s with occasional skips to 1 minute intervals. |
@beorn7 were you able to confirm the data race? |
I'm not working on this. |
I'd love to solve this but I don't currently code Go (...and it doesn't seem like a very easy "first issue" to try and pick up). |
Do we have anythin on this, I am also facing the same issue. In my case the interval is every 3 secs.
I do have multiple prom scraping the exported as i wanted to create a HA for the metrics. But i doubt it is because of that as it is happening even with a single prom scraping the metrics. |
I had something running a health-check again the /metrics path causing the error log....I'm still not sure why it does like that though. |
as noted in prometheus/graphite_exporter#123, this is likely fixable by updating the Prometheus client library to 1.5.1 or later. |
using `go get -u -t` Fixes #257, if it is not fixed already. Signed-off-by: Matthias Rampke <matthias@prometheus.io>
Our statsd logs are seeing a lot of the following (this was present in v0.12.1 also).
For context, this issue appears similar in nature: caddyserver/caddy#2537
The text was updated successfully, but these errors were encountered: