[dev] change in ngx_conf_merge_ptr_value for 0.5.33
Manlio Perillo
manlio_perillo at libero.it
Sun Nov 25 20:21:19 MSK 2007
Igor Sysoev ha scritto:
> On Sat, Nov 24, 2007 at 06:26:02PM +0100, Manlio Perillo wrote:
>
>> Igor, do you have made some changes in the ngx_conf_merge_ptr_value
>> function?
>>
>> In mod_wsgi I have:
>> ngx_conf_merge_ptr_value(conf->callable_object, prev->callable_object,
>> "application");
>>
>> for directive wsgi_application_callable.
>>
>> With 0.5.32 and 0.6.16, when the directive is not supplied, its value is
>> "application".
>>
>> With 0.5.33 it is NULL.
>>
>> conf->callable_object is a char *.
>
> Yes, it was changed (however, svn log says it was in 0.5.32 and 0.6.10):
>
> #define ngx_conf_merge_ptr_value(conf, prev, default) \
> - if (conf == NULL) { \
> - conf = (prev == NULL) ? default : prev; \
> + if (conf == NGX_CONF_UNSET_PTR) { \
> + conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev; \
> }
>
>
There is somethig wrong, here.
I'm using now 0.5.33.
In ngx_http_wsgi_create_loc_conf I set:
wlcf->callable_object = NGX_CONF_UNSET_PTR;
and in ngx_http_wsgi_merge_loc_conf:
ngx_conf_merge_ptr_value(conf->callable_object, prev->callable_object,
"application");
When directive wsgi_callable_object is not defined, then it defaults to
"application".
However if I define the directive in configuration file:
location / {
wsgi_alias /usr/local/nginx/nginx-simple.py;
wsgi_callable_object application;
}
I get a:
2007/11/25 18:07:08 [emerg] 19458#0: "wsgi_callable_object" directive is
duplicate in nginx-simple.conf:51
To understand how this works, I have tested fastcgi_catch_stderr (not
documented):
location /test {
fastcgi_pass 127.0.0.1:9000;
fastcgi_catch_stderr ops;
}
but I get a segmentation fault:
(gdb) run -c nginx-simple.conf
Starting program: /usr/local/nginx/sbin/nginx -c nginx-simple.conf
Failed to read a valid object file image from memory.
[Thread debugging using libthread_db enabled]
[New Thread -1213540672 (LWP 19510)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1213540672 (LWP 19510)]
ngx_array_push (a=0xffffffff) at src/core/ngx_array.c:59
59 if (a->nelts == a->nalloc) {
(gdb) bt
#0 ngx_array_push (a=0xffffffff) at src/core/ngx_array.c:59
#1 0x08058761 in ngx_conf_set_str_array_slot (cf=0xbf83df4c,
cmd=0x80ac618, conf=0x80cead4) at src/core/ngx_conf_file.c:935
#2 0x08059715 in ngx_conf_parse (cf=0xbf83df4c, filename=0x0) at
src/core/ngx_conf_file.c:336
#3 0x0806b7f7 in ngx_http_core_location (cf=0xbf83df4c, cmd=0x80a7aac,
dummy=0x80ccf34) at src/http/ngx_http_core_module.c:1915
#4 0x08059715 in ngx_conf_parse (cf=0xbf83df4c, filename=0x0) at
src/core/ngx_conf_file.c:336
#5 0x0806ba25 in ngx_http_core_server (cf=0xbf83df4c, cmd=0x80a79b0,
dummy=0x80c31f0) at src/http/ngx_http_core_module.c:1706
#6 0x08059715 in ngx_conf_parse (cf=0xbf83df4c, filename=0x0) at
src/core/ngx_conf_file.c:336
#7 0x080682c1 in ngx_http_block (cf=0xbf83df4c, cmd=0x80a77e0,
conf=0x80c2cd8) at src/http/ngx_http.c:218
#8 0x08059715 in ngx_conf_parse (cf=0xbf83df4c, filename=0x80c263c) at
src/core/ngx_conf_file.c:336
#9 0x080571df in ngx_init_cycle (old_cycle=0xbf83dfbc) at
src/core/ngx_cycle.c:216
#10 0x0804d8b9 in main (argc=3, argv=0xbf83e104) at src/core/nginx.c:291
So this seems a bug in the NGX_CONF_UNSET_PTR / ngx_conf_merge_ptr_value
logic.
Thanks Manlio Perillo
More information about the nginx
mailing list