-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Error: stream_api handler "prometheus" response is 26280 bytes. Only 8000 bytes is supported #7377
Comments
Logs from all files:
|
Maybe we can just remove the limit here. How you do you think @javierguerragiraldez ? |
@fffonion / @javierguerragiraldez can I try to comment out:
from |
Hey guys, before I start messing with custom/patched kong builds etc I'd like to confirm that what I'm proposing to test is actually the correct test to do. @fffonion / @javierguerragiraldez opinions? |
just removing the limit wouldn't help, since the internal nginx structures are preallocated buffers with explicit limts too (i think it was 8192, so instead of making it something like 8186 (8 bytes header), i found better to round down to 8000 for payload). |
Well, I've been trying to workaround this with no success. I tried removing the "global"
and:
Now I'm stuck. Any help is greatly appreciated as I'm not really sure how to split/rejoin replies in kong's |
I ran into the same issue. It's exacerbated by the fact that the stream API server doesn't send any response in this condition, causing the client to wait around until For the time being I'm running Kong with this patch that ensures the server always sends a response (even when the data returned from the handler is invalid/too big) and sets a low (5s) timeout for diff --git a/kong/tools/stream_api.lua b/kong/tools/stream_api.lua
index db2a4fab9..fe834ceb0 100644
--- a/kong/tools/stream_api.lua
+++ b/kong/tools/stream_api.lua
@@ -56,6 +56,7 @@ function stream_api.request(key, data, socket_path)
return nil, "sending stream-api request: " .. tostring(err)
end
+ socket:settimeout(5000)
data, err = socket:receive()
if not data then
socket:close()
@@ -102,13 +103,13 @@ function stream_api.handle()
end
if type(res) ~= "string" then
- error(st_format("stream_api handler %q response is not a string", key))
+ assert(socket:send(st_pack("=SP", 2, "handler returned invalid data")))
+ return
end
if #res > MAX_DATA_LEN then
- error(st_format(
- "stream_api handler %q response is %d bytes. Only %d bytes is supported",
- key, #res, MAX_DATA_LEN))
+ assert(socket:send(st_pack("=SP", 2, st_format("response size (%s) exceeds max of %s", #res, MAX_DATA_LEN))))
+ return
end
assert(socket:send(st_pack("=SP", 0, res))) The side effect is that stream metrics collection is still broken in all of my environments, but at least it doesn't break http metrics along with it. Chunking responses of >8000B into multiple packets seems like it'd be quite a headache to implement in UDP. Maybe this API should be reworked to use TCP instead? Sure it's more overhead, but I doubt it'd be noticeable unless the rate of requests to /metrics is insanely high. |
same issue |
Hello, |
we have also still the same issue in kong v2.5.1 |
same issue |
@joelsdc Have you solved it? What is the solution |
Hey @zhangshuaiNB, unfortunately not. As a work around I'm not using Kong for non-HTTP services until this issue is solved. @flrgh posted further up a patch to partially work around this but I don't think it's a long-term solution. Maybe @javierguerragiraldez or @fffonion can jump in and give us another update on the status of this issue? |
@joelsdc Thank you for your reply. Come on, irons |
Is there any update on this? |
still have the same issue, just updated to 2.7.0 |
still have the same issue, updated to 2.8.1 |
@flrgh I'm seeing this exact error on 2.8.1 |
Hi @xiupengrong and @esatterwhite. This change has been merged into master and will be in the next major release: https://github.com/Kong/kong/blob/master/CHANGELOG.md#unreleased Lines 338 to 339 in 5d721ac
@esatterwhite if you do not have any tcp or udp services, you can stop the prometheus plugin from using the stream API by setting |
if we are using tcp ingress, is there alternative way to reduce prometheus payload or disable prometheus? |
Same issue here with TCP ingress. |
@NagleZhang / @icebob I'm working on updating to Kong v3 myself as it has the changes that are supposed to fix this. Are you guys on 2.X or 3.X? If you are on 3.X and the problem persists it might be worth opening a new ticket with new data. |
I'm on 2.8 currently. I didn't try it on 3.x |
If you have an easy path to v3 I would give it a try. Check the release notes as the config format has some changes. I will report back once I test either way just for anyone else reaching this ticket :-) |
@flrgh same issue in kong 2.4.1 and 2.5.1, can this change be merged into 2.4.1 and 2.5.1 ? any suggestions? |
Summary
2.4.1
) using declarative config (db-less) running via docker.kong_admin_error.log
files the following error:kong/tools/stream_api.lua
says:MAX_DATA_LEN
does have a MAX of 8000 here (/kong/tools/stream_api.lua):Steps To Reproduce
prometheus
plugin enabled globallykong admin error
logs: every time prometheus server scrapes the kong exporter (in our case 30s) we see the mentioned error.Additional Details & Logs
Ubuntu 20 & Docker 20.10.6
This is a stripped down version of the config we are working, with sensitive info replaced. Please excuse me if there are any mistakes:
If you enable the two small commented out sections, the error begins. Comment them out again, error is gone.
Extra Notes
If this issue belongs in the kong-plugin-prometheus please let me know and I'll close/open the issues appropriately.
Although we see the error in the logs, the response code returned to prom is still a
200 OK
:The text was updated successfully, but these errors were encountered: