Segfault in perl module's r->print

Using $r->print() in nginx1.0’s perl module leads to a segfault. The
problem appears to be in nginx-land, not perl land.
I am using the first example listed on
http://wiki.nginx.org/EmbeddedPerlModule - this example works fine if
the $r->print()'s are commented out.

Being unfamiliar with the code, I’ve been unable to find where
ngx_pcalloc() is being called from XS_nginx_print (in
modules/perl/nginx.xs),
this seems like it’d be a fairly simple problem to fix but being
unfamiliar with the code I’ve been unable to track it down - so far.
Any assistance would be much appreciated.

backtrace:
#0 0x00007ff6c3421686 in memset () from /lib/libc.so.6
#1 0x000000000040f437 in ngx_pcalloc (pool=0xbc4210, size=80) at
src/core/ngx_palloc.c:306
#2 0x00007ff6c2f63647 in XS_nginx_print (my_perl=0xb39b20, cv=) at nginx.xs:543
#3 0x00007ff6c3e5ec0f in Perl_pp_entersub () from
/usr/lib/libperl.so.5.10
#4 0x00007ff6c3e5cf86 in Perl_runops_standard () from
/usr/lib/libperl.so.5.10
#5 0x00007ff6c3e5a9ed in Perl_call_sv () from /usr/lib/libperl.so.5.10
#6 0x0000000000478548 in ngx_http_perl_call_handler
(my_perl=0xb39b20, r=0xbc3cf0, nginx=0xb5d7f8, sub=0xb5dbb8, args=0x0,
handler=0xb3cfa0, rv=0x0)
at src/http/modules/perl/ngx_http_perl_module.c:703
#7 0x00000000004778a6 in ngx_http_perl_handle_request (r=0xbc3cf0) at
src/http/modules/perl/ngx_http_perl_module.c:221

Build details:
CFLAGS="-g3" ./configure --prefix=/home/coder/nginx/install/
–without-http-cache --without-http_charset_module
–without-http_ssi_module --without-http_userid_module
–without-http_auth_basic_module --without-http_autoindex_module
–without-http_geo_module --without-http_split_clients_module
–without-http_proxy_module --without-http_fastcgi_module
–without-http_uwsgi_module --without-http_scgi_module
–without-http_memcached_module --without-http_empty_gif_module
–without-http_browser_module --without-http_upstream_ip_hash_module
–with-file-aio --with-libatomic --with-http_dav_module
–with-http_perl_module

gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9)
perl v5.10.0

Hello!

On Sun, Apr 24, 2011 at 06:50:07AM -0400, Rob wrote:

unfamiliar with the code I’ve been unable to track it down - so far.
#5 0x00007ff6c3e5a9ed in Perl_call_sv () from /usr/lib/libperl.so.5.10
–without-http-cache --without-http_charset_module
gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9)
perl v5.10.0

Works ok here.

Most likely you have your nginx perl module (nginx.so) and nginx
itself are out of sync, i.e. compiled with different configure
options. This way I may reproduce similar segfault.

At least “–without-http-cache” will result in ABI change
(compared to nginx compiled with cache), so there is no surprise
it segfaults as a result.

Maxim D.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs