Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

ingress: nginx - could not build map_hash #1817

Closed
kayrus opened this issue Sep 30, 2016 · 3 comments · Fixed by #1879
Closed

ingress: nginx - could not build map_hash #1817

kayrus opened this issue Sep 30, 2016 · 3 comments · Fixed by #1879

Comments

@kayrus
Copy link
Contributor

kayrus commented Sep 30, 2016

Same issue I faced months ago when I provided new nginx config in this PR #1310.

E0930 16:07:51.073733       1 command.go:87] failed to execute nginx -s reload: 2016/09/30 16:07:51 [emerg] 16#16: could not build map_hash, you should increase map_hash_bucket_size: 32
nginx: [emerg] could not build map_hash, you should increase map_hash_bucket_size: 32
W0930 16:07:51.073971       1 utils.go:91] requeuing prod-uu/icp-media, err error reloading nginx: exit status 1

Today I faced it again. But the only difference - I use docker 1.11.2 and HDD instead of 1.12 and SSD. Same Ubuntu Xenial VMs with the same amount of RAM.

I successfully reproduced this error message on pure docker container with this config:
https://gist.github.com/kayrus/dcc092fe2b80b268d01dc591cfcec89a

for some reason increasing map_hash_bucket_size didn't help me months ago. But today it helped (map_hash_bucket_size 64;). Most probably it's worth to make map_hash_bucket_size option configurable in ingress.

@aledbf
Copy link
Contributor

aledbf commented Sep 30, 2016

@kayrus which version of the Ingress controller?
The next version contains a fix to adjust the size of the has tables without user intervention

@kayrus kayrus changed the title ingress: nginx - could not build map_hashcould not build map_hash ingress: nginx - could not build map_hash Oct 1, 2016
@kayrus
Copy link
Contributor Author

kayrus commented Oct 1, 2016

@aledbf 0.8.3
my nginx.conf already contains the following strings:

    types_hash_max_size 2048;
    server_names_hash_max_size 512;
    server_names_hash_bucket_size 64;

k8s-github-robot pushed a commit that referenced this issue Nov 3, 2016
Automatic merge from submit-queue

Make map_hash_bucket_size configurable

I was getting an error while trying to run the nginx controller in minikube.  This allows this nginx configuration option to be passed in through a configmap.  

The default value depends on the processor's cache line size (32 | 64 | 128), however ServerNameHashBucketSize is determined similarly, so I've set it to the same default (64).

Fixes #1817

ref kubernetes/minikube#611

cc @bprashanth
aledbf pushed a commit to aledbf/contrib that referenced this issue Nov 10, 2016
…size

Automatic merge from submit-queue

Make map_hash_bucket_size configurable

I was getting an error while trying to run the nginx controller in minikube.  This allows this nginx configuration option to be passed in through a configmap.  

The default value depends on the processor's cache line size (32 | 64 | 128), however ServerNameHashBucketSize is determined similarly, so I've set it to the same default (64).

Fixes kubernetes-retired#1817

ref kubernetes/minikube#611

cc @bprashanth
@timactive
Copy link

Hi,
@aledbf i have same issue.

I1115 13:13:49.548502       1 main.go:103] Using build version 0.46 from repo https://github.com/aledbf/contrib commit git-51c8b49
I1115 13:13:49.635783       1 main.go:131] validated kube-system/default-http-backend as the default backend
W1115 13:13:49.636543       1 ssl.go:120] no file dhparam.pem found in secrets
I1115 13:13:49.656400       1 controller.go:1044] starting NGINX Ingress controller
I1115 13:13:49.656972       1 command.go:37] Starting NGINX process...
I1115 13:13:49.672780       1 leaderelection.go:247] lock is held by nginx-ingress-controller-3ze39 and has not yet expired
W1115 13:13:50.673119       1 queue.go:84] requeuing devops/ta-registry, err deferring sync till endpoints controller has synced
E1115 13:13:50.787820       1 command.go:93] failed to execute nginx -t -c /tmp/nginx-cfg043478876: 2016/11/15 13:13:50 [emerg] 18#18: could not build map_hash, you should increase map_hash_bucket_size: 32
nginx: [emerg] could not build map_hash, you should increase map_hash_bucket_size: 32
nginx: configuration file /tmp/nginx-cfg043478876 test failed
W1115 13:13:50.787878       1 queue.go:84] requeuing kube-system/kube-scheduler, err failed to write new nginx configuration. Avoiding reload: invalid nginx configuration: exit status 1

My config

apiVersion: v1
data:
  proxy-connect-timeout: "15"
  proxy-read-timeout: "600"
  proxy-send-imeout: "600"
  hsts-include-subdomains: "false"
  body-size: "256m"
  server-names-hash-bucket-size: "256"
  server-names-hash-max-size: "1024"
  server-name-hash-bucket-size: "256"
  server-name-hash-max-size: "1024"
  types-hash-max-size: "1024"
kind: ConfigMap
metadata:
  namespace: kube-system
  name: nginx

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants