Can hide_headers_hash in ngx_http_upstream_conf_t be empty?

Thomas sunyxing at gmail.com
Mon Aug 13 06:25:24 UTC 2012


Hi, all

     I'm writing a proxy module which sends http requests to local cache
server through upstream. It seems that the worker will crush if the
upstream->conf->hide_headers_hash is empty, following is my gdb stack(nginx
1.2.2, Apple Mountain Lion):

Program received signal EXC_ARITHMETIC, Arithmetic exception.
0x00000001094a0343 in ngx_hash_find (hash=0x7febb282a970, key=3389140803,
name=0x7febb2815df4 "serverDate", len=6) at ngx_hash.c:22
22     elt = hash->buckets[key % hash->size];

(gdb) bt
#0  0x00000001094a0343 in ngx_hash_find (hash=0x7febb282a970,
key=3389140803, name=0x7febb2815df4 "serverDate", len=6) at ngx_hash.c:22
#1  0x0000000109513da4 in ngx_http_upstream_process_headers
(r=0x7febb2814600, u=0x7febb2815608) at ngx_http_upstream.c:1924
#2  0x000000010951322f in ngx_http_upstream_process_header
(r=0x7febb2814600, u=0x7febb2815608) at ngx_http_upstream.c:1639
#3  0x0000000109511618 in ngx_http_upstream_handler (ev=0x7febb283c0a0) at
ngx_http_upstream.c:935
#4  0x00000001094d8617 in ngx_kqueue_process_events (cycle=0x7febb280b850,
timer=60000, flags=1) at ngx_kqueue_module.c:684
#5  0x00000001094c706a in ngx_process_events_and_timers
(cycle=0x7febb280b850) at ngx_event.c:247
#6  0x00000001094d5844 in ngx_worker_process_cycle (cycle=0x7febb280b850,
data=0x0) at ngx_process_cycle.c:808
#7  0x00000001094d1a36 in ngx_spawn_process (cycle=0x7febb280b850,
proc=0x1094d5670 <ngx_worker_process_cycle>, data=0x0, name=0x10958b920
"worker process", respawn=-3) at ngx_process.c:198
#8  0x00000001094d4669 in ngx_start_worker_processes (cycle=0x7febb280b850,
n=1, type=-3) at ngx_process_cycle.c:365
#9  0x00000001094d3b21 in ngx_master_process_cycle (cycle=0x7febb280b850)
at ngx_process_cycle.c:137
#10 0x000000010949b511 in main (argc=1, argv=0x7fff56765cd0) at nginx.c:410

(gdb) f 1
#1  0x0000000109513da4 in ngx_http_upstream_process_headers
(r=0x7febb2814600, u=0x7febb2815608) at ngx_http_upstream.c:1924
1924         if (ngx_hash_find(&u->conf->hide_headers_hash, h[i].hash,

(gdb) f 0
#0  0x00000001094a0343 in ngx_hash_find (hash=0x7febb282a970,
key=3389140803, name=0x7febb2815df4 "serverDate", len=6) at ngx_hash.c:22
22     elt = hash->buckets[key % hash->size];

(gdb) p *hash
$6 = {
  buckets = 0x0,
  size = 0
}

I checked ngx_http_proxy_module and it fills the hash with some default
values, but what should I do if i'm not hiding any response header?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20120813/18e7d355/attachment.html>


More information about the nginx-devel mailing list