Sirsiwal, Umesh
May 17, 2011 11:16PM
Thank agentzh,
The original code was trying to correctly send the error code in presence of error returned by upstream.

I ran my nginx under valgrind today. Periodically I get the following. This is probably something in luajit but I wanted to report this here before I report it to luajit list.

==21286== Conditional jump or move depends on uninitialised value(s)
==21286== at 0x5788D2E: lj_str_new (lj_str.c:66)
==21286== by 0x578E014: lua_pushlstring (lj_api.c:581)
==21286== by 0x498291: ngx_http_lua_var_get (ngx_http_lua_util.c:711)
==21286== by 0x5783718: lj_BC_FUNCC (in /usr/local/lib/libluajit-5.1.so.2.0.0)
==21286== by 0x49872D: ngx_http_lua_run_thread (ngx_http_lua_util.c:997)
==21286== by 0x49B267: ngx_http_lua_access_by_chunk (ngx_http_lua_accessby.c:78)
==21286== by 0x49B464: ngx_http_lua_access_handler_file (ngx_http_lua_accessby.c:128)
==21286== by 0x49B0F2: ngx_http_lua_access_handler (ngx_http_lua_accessby.c:250)
==21286== by 0x457FDC: ngx_http_core_access_phase (ngx_http_core_module.c:1060)
==21286== by 0x4541D2: ngx_http_core_run_phases (ngx_http_core_module.c:837)
==21286== by 0x4542CF: ngx_http_handler (ngx_http_core_module.c:820)
==21286== by 0x45E59B: ngx_http_process_request (ngx_http_request.c:1671)
==21286==

-Umesh
________________________________________
From: agentzh [agentzh@gmail.com]
Sent: Wednesday, May 11, 2011 12:20 AM
To: Sirsiwal, Umesh
Cc: nginx-devel@nginx.org
Subject: Re: Nginx-LuaJIT core

On Wed, May 11, 2011 at 6:18 AM, Umesh Sirsiwal <usirsiwal@verivue.com> wrote:
> I have not yet run the nginx with valgrind. However, changing the original
> lua file to the following fixes the issue. It turns out the output can be
> 100MB+. I will keep digging.
>
> local prox = 3201
> local nrAgent = 8
> ngx.print("coblitzstat\n")
> for p = prox, prox+nrAgent-1 do
> local l = "/prox" .. p .. ngx.var['request_uri']
> print("copass: fetching location " .. l)
> local res = ngx.location.capture(l)
>
> if (res.status ~= ngx.HTTP_OK and res.status ~= 504) then
> return(res.status)
> end
> if(res.status == ngx.HTTP_OK and string.len(res.body)> 0) then
> ngx.print(res.body)
> end
> end
>

Just a side note: calling ngx.print() right after
ngx.location.capture() in your loop is strongly recommended because
for HTTP 1.1 requests, the upstream and downstream (non-blocking)
network I/O can be overlapped very well in this scenario, thus
increasing the overall throughput, reducing response latency, and
decreasing memory use on the server side :)

For HTTP 1.0 requests, where ngx_lua will automatically buffer all the
outputs on the C level in order to obtain the response length and make
up a proper Content-Length header for the HTTP 1.0 response.

Thank you for digging into this issue ;)

Best,
-agentzh

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Nginx-LuaJIT core

Sirsiwal, Umesh 3470 May 09, 2011 10:58PM

Re: Nginx-LuaJIT core

agentzh 816 May 09, 2011 11:18PM

RE: Nginx-LuaJIT core

Sirsiwal, Umesh 802 May 09, 2011 11:48PM

Re: Nginx-LuaJIT core

agentzh 712 May 10, 2011 05:56AM

Re: Nginx-LuaJIT core

Umesh Sirsiwal 774 May 10, 2011 06:14PM

Re: Nginx-LuaJIT core

agentzh 878 May 11, 2011 12:22AM

RE: Nginx-LuaJIT core

Sirsiwal, Umesh 1290 May 17, 2011 11:16PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 181
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready