-
Notifications
You must be signed in to change notification settings - Fork 2k
Strange thing while change ngx.arg[1] in body_filter_by_lua* #1906
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
Comments
please check if it still exists in openresty 1.19.3 |
nothing changed. |
If I jsut set ngx.header.content_length to nil in header_filter_by_lua_block and has no body_filter_by_lua_block, Once touching ngx.arg[1] in body_filter_by_lua_block, chunk size will be 512K+1Bytes, quite weird. |
Everthing works well when nginx output_buffers is small enough. |
this config will copy buffer from nginx buffer chain to a lua string, and then the assignment will copy the string buffer back to nginx. so there will so many different lua strings which will consume much of the memory. there is not need to set ngx.arg[1]=ngx.arg[1] in body_filter_by_lua_block. |
Sorry for my expression. 'ngx.arg[1]=ngx.arg[1]' in body_filter_by_lua_block is just for test, it is much more complicated in fact. |
there is still something I can not explain exactly. |
#1909 |
I tested with PR #1909 code, problem disappeared. @zhuizhuhaomeng Thanks. |
Uh oh!
There was an error while loading. Please reload this page.
oprenresty version:1.15.8
I want to change file stream while downloading, but I encountered a strange thing
that once I touch ngx.arg[1] in body_filter_by_lua*, client will receive some little response first,
then wait untill nginx process process the whole file.
Client will receive the whole file, but client receives nothing for a quite long time.
Nginx worker process will occupy memory about the same size as the file.
So what's the point?
I test with the following lua code for simplify, same thing happened too.
File has size bigger than 1GB.
I know when set ngx.header.content_length to nil,
http response will use chunked Transfer-Encoding,
and client will receive the file content via chunks.
I capture the http protocol with wireshark and
check the chunk response, client receive part of first chunk
and then wait untill the whole file porcessed done.
The text was updated successfully, but these errors were encountered: