Trickster's health endpoint infinitely appends to the "Via" header on upstream requests, ultimately causing an HTTP 431 error #531
Labels
1.1 release
Feature/Fix will be available in 1.1 Release
bug
Something isn't working
healthchecking
affects health checking
Hi!
I recently set up Trickster behind a load balancer that checks Trickster's
/trickster/health/default
endpoint every second or so. After a Trickster node has been up for around 5 days, the load balancer marks the node as down. My first instinct was to check viacurl
, which returned HTTP 431. Restarting Trickster solved the problem, but it ultimately resurfaced. I had a look at a Grafana dashboard fornode_exporter
and found this:The curious looking pattern is from the loopback/localhost interface and the sudden drops correspond with Trickster restarting; Trickster's default backend is Promxy running on the same host (via localhost). After seeing the above dashboard panel, I used
tcpdump
to examine the traffic between Trickster and Promxy. This revealed giantVia
headers in the requests from Trickster to Promxy. I restarted Trickster and noted that the value forVia
was appended to with every request to/trickster/health/default
. Thinking this was an error on my part, I configured Trickster on my laptop and pointed it directly at a Prometheus server with the simplest possible configuration:During the next phase of troubleshooting, I used
dlv
to pinpoint the source of the problem. I'm very far from proficient with Go, but I believe this line is the culprit. Based on what I've read, the right side of the assignment is passing a pointer. Subsequent operations (such as inSetVia()
) cause unintended side effects. Please correct me if I'm wrong!I was able to ameliorate the problem with this patch:
I'd submit a PR but I'm not sure if my "solution" is acceptable (
strings.Join()
seems smelly, for example). I'm also open to the suggestion that I'm doing something wrong :)The text was updated successfully, but these errors were encountered: