Lua Variable access bug?
Maxim Dounin
mdounin at mdounin.ru
Thu May 17 13:06:49 UTC 2012
Hello!
On Thu, May 17, 2012 at 07:42:45PM +0800, agentzh wrote:
> On Thu, May 17, 2012 at 5:02 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> > Shouldn't it be
> >
> > --- a/src/http/ngx_http_variables.c
> > +++ b/src/http/ngx_http_variables.c
> > @@ -2072,6 +2072,11 @@ ngx_http_variables_init_vars(ngx_conf_t
> > v = cmcf->variables.elts;
> > key = cmcf->variables_keys->keys.elts;
> >
> > + for (n = 0; n < cmcf->variables_keys->keys.nelts; n++) {
> > + av = key[n].value;
> > + av->flags &= ~NGX_HTTP_VAR_INDEXED;
> > + }
> > +
> > for (i = 0; i < cmcf->variables.nelts; i++) {
> >
> > for (n = 0; n < cmcf->variables_keys->keys.nelts; n++) {
> >
> >
> > instead?
> >
>
> Yes, this patch is better and is more efficient :)
No, disregard this patch. It will break things if new
configuration will be rejected for some reason, as global in
master will be left in an inconsistent state. As a result
incorrect worker processes will be spawn e.g. after abnormal
termination of a worker process (or after SIGWINCH + SIGHUP
sequence).
Allocating temporary copy of a variable looks like the only
correct way.
Maxim Dounin
More information about the nginx-devel
mailing list