Segfault in perl module's r->print

Rob madcamel at
Sun Apr 24 14:50:07 MSD 2011

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 - 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
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.

#0  0x00007ff6c3421686 in memset () from /lib/
#1  0x000000000040f437 in ngx_pcalloc (pool=0xbc4210, size=80) at
#2  0x00007ff6c2f63647 in XS_nginx_print (my_perl=0xb39b20, cv=<value
optimized out>) at nginx.xs:543
#3  0x00007ff6c3e5ec0f in Perl_pp_entersub () from /usr/lib/
#4  0x00007ff6c3e5cf86 in Perl_runops_standard () from /usr/lib/
#5  0x00007ff6c3e5a9ed in Perl_call_sv () from /usr/lib/
#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

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

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

More information about the nginx mailing list