Hello,
I am trying to reload nginx and keep getting this error:
nginx: [emerg] could not build the referers_hash, you should increase
referers_hash_bucket_size: 64
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
Nginx Version: 1.0.8
nginx.conf - gist:a113dd815b591fa841c3 · GitHub
Thanks in advance.
Regards,
Justin D. http://www.twitter.com/jdorfman
On Thu, 2012-03-29 at 17:11 -0700, Justin D. wrote:
nginx: [emerg] could not build the referers_hash, you should increase
referers_hash_bucket_size: 64
I hate to ask the obvious, but did you try increasing
referers_hash_bucket_size?
server {
referers_hash_bucket_size 128;
}
This variable seems undocumented (aside from a note it appeared in
1.0.5), but the error message appears helpful enough.
Regards,
Cliff
Hey Cliff,
I did, same issue. The way we ended up “fixing” it was deleting all of
the
vhosts and syncing them from another PoP.
Thanks
Regards,
Justin D. http://www.twitter.com/jdorfman
On Thu, 2012-03-29 at 19:04 -0700, Justin D. wrote:
Hey Cliff,
I did, same issue. The way we ended up “fixing” it was deleting all
of the vhosts and syncing them from another PoP.
How large did you make the value? With a large number of vhosts the
value might need to be significantly higher. Also, I’m not sure of the
context for this value, it might need to be at the http level.
There’s also a related value, referers_hash_bucket_size that might need
to be increased.
The only information I found was from this thread (translated from
Russian via google):
2011/7/19 Igor S. igor@xxxxxxxxx:
Changes in nginx 1.0.5 19.07.2011
*) Feature: the referer_hash_max_size and
Referer_hash_bucket_size.
Thank you Witold Filipczyk.
With these guidelines, there are some problems:
- In the error messages as they are called, and referers_hash_max_size
referers_hash_bucket_size
- The default value for referer_hash_max_size in the error message
described as a 128 (actually - 2048)
- It is not clear how to find exactly where the problem
that is, such as the diagnosis is
nginx: [emerg] could not build the referers_hash, you should increase
referers_hash_bucket_size: 64
But that’s not enough, as the context for referer_hash_max_size server
and location
Regards,
Cliff
On Fri, 2012-03-30 at 09:08 -0700, Justin D. wrote:
Hey Cliff,
Here are the current values:
server_names_hash_max_size 65536;
server_names_hash_bucket_size 256;
These are not the hashes you are looking for =) Your error message
specified “you should increase referers_hash_bucket_size”, indicating
that it is currently 64.
Regards,
Cliff
Our senior engineer figured how to fix it.
What he did was edited this file:
src/http/modules/ngx_http_referer_module.c
and changed this line:
prev->referer_hash_bucket_size, 64);
to:
prev->referer_hash_bucket_size, 128);
Then recompiled nginx.
Hope that helps someone in the future.
Regards,
Justin D. http://www.twitter.com/jdorfman
Hello!
On Mon, Apr 09, 2012 at 12:49:43PM -0700, Justin D. wrote:
Then recompiled nginx.
Hope that helps someone in the future.
There is configuration directive to adjust this,
referer_hash_bucket_size. You don’t need to edit the code.
Maxim D.
On Fri, 2012-03-30 at 09:08 -0700, Justin D. wrote:
specified “you should increase referers_hash_bucket_size”, indicating
There is configuration directive to adjust this,
referer_hash_bucket_size. You don’t need to edit the code.
Maxim D.
I got caught by this bug too,
Seems a bit strange why the defaults (if not set) complains that its
not enough… I can see why people edit the code directly.
If 64 isn’t clearly enough when referer_hash_bucket_size isn’t set,
why not just up the default to 128 to avoid this unnecessary complaint
by nginx.
Hey Cliff,
Here are the current values:
server_names_hash_max_size 65536;
server_names_hash_bucket_size 256;
The number of vhosts we have on that cluster is 23,252 (not all active,
need to clean that up.)
Are those values sufficient for the amount of vhosts?
FYI We have 32gb of ram if that makes any difference.
Regards,
Justin D. http://www.twitter.com/jdorfman
Hello!
On Wed, Apr 11, 2012 at 01:53:08AM +1200, Ryan B. wrote:
If 64 isn’t clearly enough when referer_hash_bucket_size isn’t set,
why not just up the default to 128 to avoid this unnecessary complaint
by nginx.
The default is enough in most cases. There are some specific
situations (long values in hash, multiple colliding values) which
trigger the message, and the message itself explains what to do
(and we have the page at Setting up hashes which
explains details).
We might want to better (read: automatically) handle some
situation like non-colliding long values, where the only sensible
solution is to increase …_hash_bucket_size, but this has nothing
to do with defaults change. With any default one will be able to
write a configuration which triggers the “could not build hash”
message.
Maxim D.