On Wed, Jul 24, 2013 at 03:49:05PM -0700, John W. wrote:
Hi there,
Upgraded from 1.2.9 to 1.4.1 and now started getting:
[emerg] could not build the variables_hash, you should increase either
variables_hash_max_size: 512 or variables_hash_bucket_size: 64
adding this to http block fixes it:
variables_hash_max_size 1024;
Any ideas? Or direction on debugging?
What’s the problem?
You got an error message which asked you to change one of two
directives;
you checked the documentation for those directives which pointed you to
another document which told you which one to change first; you changed
that one; and the error state no longer applies.
Just for the reference, there is no bugs in ngx_srcache.
It’s just that enabling many nginx modules (including standard ones
and 3rd-party ones) exceeds the variables_hash_max_size limit (default
value). See below for more details:
How many variables are in total in the configuration in question?
I’ve just checked. There are only 124 variables.
I suspect the real problem is hash collisions.
Yeah, it seems like that
Especially this used
to hit people under qemu where cache line size of an emulated CPU
is detected as 32 by nginx, see here:
Well, this is a modern Linux x86_64 system running on real hardware
though
Not sure how to properly address it though. Right now I think
just automatically doubling bucket_size if we wasn’t able to build
hash might be a good idea.
Given the current rich ecosystem of nginx, maybe the nginx core should
increase the default value of variables_hash_max_size? Not sure
though.
How many variables are in total in the configuration in question?
Standard nginx with almost all modules compiled in (and a few
extra modules) here has just 114 variables, and 512 looks big
enough.
I suspect the real problem is hash collisions. Especially this used
to hit people under qemu where cache line size of an emulated CPU
is detected as 32 by nginx, see here:
Not sure how to properly address it though. Right now I think
just automatically doubling bucket_size if we wasn’t able to build
hash might be a good idea.