nginx worker segfault, NULL pool

Maxim Dounin mdounin at mdounin.ru
Sun Jun 10 00:03:18 UTC 2012


Hello!

On Sat, Jun 09, 2012 at 04:54:01PM +0200, Bruno Prémont wrote:

> Hallo Maxim,
> 
> On Sat, 09 June 2012 Maxim Dounin <mdounin at mdounin.ru> wrote:
> > On Fri, Jun 08, 2012 at 11:40:46PM +0200, Bruno Prémont wrote:
> > > > On Fri, 08 June 2012 Maxim Dounin <mdounin at mdounin.ru> wrote:
> > > > > On Fri, Jun 08, 2012 at 02:40:52PM +0200, Bruno Prémont wrote:
> > > > > > Running nginx on ARM I'm having it segfault at about any request (those
> > > > > > known not to crash are /status/nginx and /status/php-fpm).
> > > > > > Attaching it with GDB I get the following trace:
> > > > > 
> > > > > [...]
> > > > > 
> > > > > >         geoip_country  /usr/share/GeoIP/GeoIPv6.dat;
> > > > > 
> > > > > Is it works for you if you don't use GeoIP?
> > > > 
> > > > Just disabling it config side makes no difference.
> > > > 
> > > > I will try disabling it at configure time and see if it changes
> > > > anything, though I doubt it will.
> > > 
> > > Exact same result when geoip support is not built at all.
> > > 
> > > 
> > > Looking more exactly at the URLs I tested, static file like images
> > > don't crash the worker, just those that get handled by php-fpm upstream
> > > do (e.g. /collectd/ which implies /collectd/index.php).
> > 
> > You've claimed above "/status/php-fpm" works ok too.  Is it was 
> > mistake?
> > 
> > Anyway, please make sure you have aligment problems properly 
> > reported by a kernel.  It looks like the linux kernel has an 
> > unfortunate default to silently ignore alignment problems on arm, 
> > which results in data corruption on unaligned accesses instead of 
> > immediate exit on SIGBUS when unaligned access happens.  You may 
> > get proper behaviour with
> > 
> > echo 4 > /proc/cpu/alignment 
> > 
> > This should allow to trace a root of your problems.
> > 
> > See http://lecs.cs.ucla.edu/wiki/index.php/XScale_alignment for 
> > more details.
> 
> Thanks for the pointer, will read trough it!
> 
> Seems to be that one, after echoing 4 to /proc/cpu/alignment nginx
> does not even start anymore (and `nginx -t` fails as well), each time with
> SIGBUS.
> 
> e.g. for `nginx -t` the first SIGBUS happens at
> 
> #0  0x0000d64c in ngx_set_cpu_affinity (cf=0xbe892358, cmd=<optimized out>, conf=<optimized out>) at src/core/nginx.c:1275
> #1  0x0001cafc in ngx_conf_handler (last=13909340, cf=0xbe892358) at src/core/ngx_conf_file.c:394
> #2  ngx_conf_parse (cf=0xbe892358, filename=0xd43d70) at src/core/ngx_conf_file.c:244
> #3  0x0001aba4 in ngx_init_cycle (old_cycle=0xbe8923c0) at src/core/ngx_cycle.c:268
> #4  0x0000e29c in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:331
> 
> as backtraced with gdb.

Ok, this looks sensisble.

Could you please provide ./configure output and test if the 
following patch fixes things for you?

diff --git a/auto/os/conf b/auto/os/conf
--- a/auto/os/conf
+++ b/auto/os/conf
@@ -93,6 +93,7 @@ case "$NGX_MACHINE" in
     ;;
 
     *)
+        have=NGX_ALIGNMENT value=16 . auto/define
         NGX_MACH_CACHE_LINE=32
     ;;
 


Maxim Dounin



More information about the nginx mailing list