-
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
Lua filter: httpCall() terminates abruptly in envoy_on_response() when used after bodyChunks() #8785
Comments
I'm not sure what is going on here exactly, but something is strange with the logic here:
cc @dio @derekargueta who I think have been in this code more recently. |
To properly buffer the response, the "blocking" |
Hi @dio I'm not why this was closed as it's still a bug that the filter chain continues without finishing the Lua envoy_on_response() code if bodyChunks() is used. There is a noticeable difference in response times if I use body() vs bodyChunks(). |
oops sorry, I meant to close my PR which has wrong approach. |
@v1b1 just curious, have you tried to use the latest version of Envoy? I simulated this, yes, the response from envoy (proxying data from upstream) comes early (before the And probably you can consider using "async" (fire-and-forget) |
@dio I'll give it a try when I can, we recently were allowed to update to v1.13.0 and once I have the cycles to test I will do so. The main driver behind this is to mirror 100% of requests and responses for audit purposes, without the developers having to write and maintain the payload logging code themselves. Would an HTTP tap provide better performance? |
Hello, I encountered the same bug with the 1.10.0 version, I tried with the latest version 1.15.0 and the bug is still here. Here is the envoy_on_response function I'm using :
And this is the logs I get, starting from after the chunking is done.
Expected behavior : the LUA script waits for the httpCall to end and after that the client finally gets the response EDIT : Regardless of the |
Still an issue in latest stable & dev builds. Any likelihood of this being revived or solved in a wider scoped task? |
Title: Lua filter: httpCall() terminates abruptly in envoy_on_response() when used after bodyChunks()
Description:
In an attempt to shadow an upstream response using a Lua filter, I use envoy_on_response() to collect the response data using either body() or bodyChunks(), then use httpCall() to send the data to a special logging cluster. Buffering the response with body() and sending with httpCall() works as expected, but using bodyChunks() followed by httpCall() does not; the connection to the logging cluster terminates from the Lua side before it is able to finish sending the data.
Envoy Version: v1.11.1 (alpine docker image)
Repro steps:
GET /xxlarge
); I run Envoy and the services on a separate server from my tests. The logging cluster simply responds with status code 204.curl -s -o /dev/null -D - envoy-host:8080/log/buffer/xxlarge
to observe expected behaviour with buffered responses. Logs are provided inbuffered_output
below.curl -s -o /dev/null -D - envoy-host:8080/log/xxlarge
to see thatenvoy_on_response()
does not complete execution. Note that the output of logDebug() calls after httpCall() do not appear. Logs provided instreamed_output
below.Notes: If the response payload is small enough and
txn_logger
is fast enough to receive the data from httpCall(), then I am able to see the final logDebug() call in the streamed response example.Config:
lds.yaml
rds.yaml
cds.yaml
envoy.yaml
Logs:
buffered_output
streamed_output
The text was updated successfully, but these errors were encountered: