[ANN] ngx_lua v0.1.4: ability to disable the Lua code cache

Roman Vasilyev roman at anchorfree.com
Thu Feb 3 22:22:54 MSK 2011


Hi,

I'm using this module on one of my production servers and seems like 
memory leak presents in this module.
My lua config is below.
         location / {
           include proxy.conf;

       location = /check-spam {
             internal;

             include spam_fastcgi.conf;
           }

           lua_need_request_body on;

           rewrite_by_lua '
             if ngx.var.request_method ~= "POST" then
               return
             end
             local res = ngx.location.capture(
             "/check-spam",
             { method = ngx.HTTP_POST, body = ngx.var.request_body }
             )
             a=string.sub(res.body,0,4)=="SPAM"
             if a then
               return ngx.redirect("/terms-of-use.html")
             end
           ';

         }


On 01/24/2011 02:31 AM, agentzh wrote:
> Hi, folks!
>
> I'm delighted to announce the ngx_lua v0.1.4 release which features
> the ability to disable the Lua code cache to ease Lua development. You
> can get the release tarball from the download page:
>
>     https://github.com/chaoslawful/lua-nginx-module/downloads
>
> By default, Lua code loaded into the ngx_lua module will be cached
> (the compiled/JIT'd form will be cached). So changing .lua files
> requires reloading or restarting the nginx server. From this release,
> we can use the following directive to disable the code cache:
>
>      lua_code_cache off;
>
> Then the Lua files referenced in set_by_lua_file, content_by_lua_file,
> access_by_lua_file, and rewrite_by_lua_file won't be cached at all,
> and Lua's "package.loaded" table will be cleared at every request's
> entry point (such that Lua modules won't be cached either). So
> developers and enjoy the PHP-way, i.e., edit-and-refresh.
>
> But please note that Lua code inlined into nginx.conf like those
> specified by set_by_lua, content_by_lua, access_by_lua, and
> rewrite_by_lua will *always* be cached because only nginx knows how to
> parse nginx.conf and the only way to tell it to re-load the config
> file is to send a HUP signal to it or just to restart it from scratch.
>
> For now, ngx_lua does not support the "stat" mode like Apache's
> mod_lua, but we will work on it in the future.
>
> This release also contains a small over-all optimization that the keys
> used for Lua code cache lookups are pre-calculated at config time
> wherever possible.
>
> The ngx_lua module embeds the Lua/LuaJIT interpreter into the nginx
> core and integrates the powerful Lua threads (aka Lua coroutines) into
> the nginx event model by means of nginx subrequests.
>
> You can get the latest source code and full documentation from the
> ngx_lua's project page:
>
>     https://github.com/chaoslawful/lua-nginx-module/
>
> Have fun!
> -agentzh
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>    




More information about the nginx mailing list