Last modified: 2013-05-21 08:30:55 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T50210, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 48210 - [upstream] [worked around] nginx fails: could not build the types_hash
[upstream] [worked around] nginx fails: could not build the types_hash
Status: RESOLVED FIXED
Product: Wikimedia Labs
Classification: Unclassified
deployment-prep (beta) (Other open bugs)
unspecified
All All
: Normal minor
: ---
Assigned To: Nobody - You can work on this!
: upstream
Depends on:
Blocks: 36648
  Show dependency treegraph
 
Reported: 2013-05-07 13:24 UTC by Antoine "hashar" Musso (WMF)
Modified: 2013-05-21 08:30 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Antoine "hashar" Musso (WMF) 2013-05-07 13:24:18 UTC
On labs nginx refuse to start out:

Restarting nginx: nginx: [emerg] could not build the types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 32

Nginx loads the mime type in a hash which has the mime name for keys, one of the keys is 36 bytes long which does not fit the 32 bytes limit.

The limit itself is set by Nginx on startup and attempt to match the CPU cache line.  It does so by looking up the processor vendor / model and set the name.


The lookup code is src/core/ngx_cpuinfo.c , function ngx_cpuinfo()

For vendor 'GenuineIntel':

 family 5 > cache line is 32
 family 6 > cache line is 32 or 64 bits depending on model
 family 15 > cache line is 128

In production we are using Intel Xeon which cpu info reports as:

vendor_id  : GenuineIntel
cpu family : 6
model      : 30
stepping   : 5
cache_alignement: 64

Given the model, I am assuming nginx finds out 64.


In labs:

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 2
model name	: QEMU Virtual CPU version 1.0
stepping	: 3
microcode	: 0x1
cpu MHz		: 2659.998
cache size	: 4096 KB
fpu		: yes
fpu_exception	: yes
cpuid level	: 4
wp		: yes
flags		: fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm up rep_good nopl pni vmx cx16 popcnt hypervisor lahf_lm
bogomips	: 5319.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 40 bits physical, 48 bits virtual
power management:

Given the low model, we end up with a cache line of 32 bytes.


If cache_alignment (64) is the cache line size, that should have been the value retained by Nginx.


Anyway, the mime type hash ends up being 32 bytes which is too small to hold the longest mime type names.


The workaround is to set types_hash_bucket_size at 64.

We are using Nginx 1.1.19 from Ubuntu Precise.
Comment 1 Antoine "hashar" Musso (WMF) 2013-05-07 13:28:57 UTC
Nginx 1.4.1 and 1.5.0 have the same code so they are most probably affected as well.
Comment 2 Antoine "hashar" Musso (WMF) 2013-05-07 13:41:24 UTC
Upstream ticket http://trac.nginx.org/nginx/ticket/352
Comment 3 Gerrit Notification Bot 2013-05-07 14:01:51 UTC
Related URL: https://gerrit.wikimedia.org/r/62603 (Gerrit Change Ieddf98ffae1a97aa1b533726453232a06f765bd2)
Comment 4 Antoine "hashar" Musso (WMF) 2013-05-07 14:13:15 UTC
Worked around by above change which is to hardcode the value to 64 whenever nginx is installed on labs.  Lowering priority and unassigning myself.
Comment 5 Antoine "hashar" Musso (WMF) 2013-05-14 11:45:41 UTC
and server_names_hash_bucket_size for https://gerrit.wikimedia.org/r/#/c/63646/ .
Comment 6 Antoine "hashar" Musso (WMF) 2013-05-21 08:30:55 UTC
Tweaking the bucket sizes solved the issue.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links